mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
feat: settings is now json, refactor panels to be able to dismiss by clicking outside
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import qs.Settings
|
||||
|
||||
ColumnLayout {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import qs.Settings
|
||||
|
||||
@@ -9,19 +9,10 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 340
|
||||
color: Theme.surface
|
||||
Layout.topMargin: 12
|
||||
radius: 18
|
||||
border.color: "transparent"
|
||||
border.width: 0
|
||||
Layout.bottomMargin: 16
|
||||
property bool showActiveWindowIcon: false
|
||||
signal showAWIconChanged(bool showActiveWindowIcon)
|
||||
property bool showSystemInfoInBar: true
|
||||
signal showSystemInfoChanged(bool showSystemInfoInBar)
|
||||
property bool showMediaInBar: false
|
||||
signal showMediaChanged(bool showMediaInBar)
|
||||
property string visualizerType: Settings.visualizerType
|
||||
signal visualizerTypeUpdated(string type)
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@@ -66,7 +57,7 @@ Rectangle {
|
||||
id: avatarImage
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
source: Settings.profileImage
|
||||
source: Settings.settings.profileImage
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
visible: false
|
||||
asynchronous: true
|
||||
@@ -83,7 +74,7 @@ Rectangle {
|
||||
radius: avatarImage.width / 2
|
||||
visible: false
|
||||
}
|
||||
visible: Settings.profileImage !== ""
|
||||
visible: Settings.settings.profileImage !== ""
|
||||
}
|
||||
|
||||
// Fallback icon
|
||||
@@ -93,7 +84,7 @@ Rectangle {
|
||||
font.family: "Material Symbols Outlined"
|
||||
font.pixelSize: 18
|
||||
color: Theme.accentPrimary
|
||||
visible: Settings.profileImage === ""
|
||||
visible: Settings.settings.profileImage === ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +101,7 @@ Rectangle {
|
||||
id: profileImageInput
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
text: Settings.profileImage
|
||||
text: Settings.settings.profileImage
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
@@ -120,7 +111,7 @@ Rectangle {
|
||||
activeFocusOnTab: true
|
||||
inputMethodHints: Qt.ImhNone
|
||||
onTextChanged: {
|
||||
Settings.profileImage = text
|
||||
Settings.settings.profileImage = text
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
@@ -154,8 +145,8 @@ Rectangle {
|
||||
width: 52
|
||||
height: 32
|
||||
radius: 16
|
||||
color: showActiveWindowIcon ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: showActiveWindowIcon ? Theme.accentPrimary : Theme.outline
|
||||
color: Settings.settings.showActiveWindowIcon ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: Settings.settings.showActiveWindowIcon ? Theme.accentPrimary : Theme.outline
|
||||
border.width: 2
|
||||
|
||||
Rectangle {
|
||||
@@ -167,7 +158,7 @@ Rectangle {
|
||||
border.color: Theme.outline
|
||||
border.width: 1
|
||||
y: 2
|
||||
x: showActiveWindowIcon ? customSwitch.width - width - 2 : 2
|
||||
x: Settings.settings.showActiveWindowIcon ? customSwitch.width - width - 2 : 2
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
@@ -177,7 +168,7 @@ Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
showAWIconChanged(!showActiveWindowIcon)
|
||||
Settings.settings.showActiveWindowIcon = !Settings.settings.showActiveWindowIcon
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,8 +197,8 @@ Rectangle {
|
||||
width: 52
|
||||
height: 32
|
||||
radius: 16
|
||||
color: showSystemInfoInBar ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: showSystemInfoInBar ? Theme.accentPrimary : Theme.outline
|
||||
color: Settings.settings.showSystemInfoInBar ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: Settings.settings.showSystemInfoInBar ? Theme.accentPrimary : Theme.outline
|
||||
border.width: 2
|
||||
|
||||
Rectangle {
|
||||
@@ -219,7 +210,7 @@ Rectangle {
|
||||
border.color: Theme.outline
|
||||
border.width: 1
|
||||
y: 2
|
||||
x: showSystemInfoInBar ? customSwitch2.width - width - 2 : 2
|
||||
x: Settings.settings.showSystemInfoInBar ? customSwitch2.width - width - 2 : 2
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
@@ -229,7 +220,7 @@ Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
showSystemInfoChanged(!showSystemInfoInBar)
|
||||
Settings.settings.showSystemInfoInBar = !Settings.settings.showSystemInfoInBar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,8 +249,8 @@ Rectangle {
|
||||
width: 52
|
||||
height: 32
|
||||
radius: 16
|
||||
color: showMediaInBar ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: showMediaInBar ? Theme.accentPrimary : Theme.outline
|
||||
color: Settings.settings.showMediaInBar ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: Settings.settings.showMediaInBar ? Theme.accentPrimary : Theme.outline
|
||||
border.width: 2
|
||||
|
||||
Rectangle {
|
||||
@@ -271,7 +262,7 @@ Rectangle {
|
||||
border.color: Theme.outline
|
||||
border.width: 1
|
||||
y: 2
|
||||
x: showMediaInBar ? customSwitch3.width - width - 2 : 2
|
||||
x: Settings.settings.showMediaInBar ? customSwitch3.width - width - 2 : 2
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
@@ -281,7 +272,7 @@ Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
showMediaChanged(!showMediaInBar)
|
||||
Settings.settings.showMediaInBar = !Settings.settings.showMediaInBar
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,9 +309,9 @@ Rectangle {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: visualizerType === "fire" ? "Fire" :
|
||||
visualizerType === "diamond" ? "Diamond" :
|
||||
visualizerType === "radial" ? "Radial" : "Radial"
|
||||
text: Settings.settings.visualizerType === "fire" ? "Fire" :
|
||||
Settings.settings.visualizerType === "diamond" ? "Diamond" :
|
||||
Settings.settings.visualizerType === "radial" ? "Radial" : "Radial"
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
}
|
||||
@@ -350,19 +341,19 @@ Rectangle {
|
||||
MenuItem {
|
||||
text: "Fire"
|
||||
onTriggered: {
|
||||
visualizerTypeUpdated("fire")
|
||||
Settings.settings.visualizerType = "fire"
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: "Diamond"
|
||||
onTriggered: {
|
||||
visualizerTypeUpdated("diamond")
|
||||
Settings.settings.visualizerType = "diamond"
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: "Radial"
|
||||
onTriggered: {
|
||||
visualizerTypeUpdated("radial")
|
||||
Settings.settings.visualizerType = "radial"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,7 +385,7 @@ Rectangle {
|
||||
id: videoPathInput
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
text: Settings.videoPath !== undefined ? Settings.videoPath : ""
|
||||
text: Settings.settings.videoPath !== undefined ? Settings.settings.videoPath : ""
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
@@ -403,7 +394,7 @@ Rectangle {
|
||||
activeFocusOnTab: true
|
||||
inputMethodHints: Qt.ImhUrlCharactersOnly
|
||||
onTextChanged: {
|
||||
Settings.videoPath = text
|
||||
Settings.settings.videoPath = text
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.Settings
|
||||
@@ -22,24 +22,6 @@ PanelWindow {
|
||||
//border.width: 1
|
||||
WlrLayershell.keyboardFocus: visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
|
||||
// Local properties for editing (not saved until apply)
|
||||
property string tempWeatherCity: (Settings.weatherCity !== undefined && Settings.weatherCity !== null) ? Settings.weatherCity : ""
|
||||
property bool tempUseFahrenheit: Settings.useFahrenheit
|
||||
property string tempProfileImage: (Settings.profileImage !== undefined && Settings.profileImage !== null) ? Settings.profileImage : ""
|
||||
property string tempWallpaperFolder: (Settings.wallpaperFolder !== undefined && Settings.wallpaperFolder !== null) ? Settings.wallpaperFolder : ""
|
||||
property bool tempShowActiveWindowIcon: Settings.showActiveWindowIcon
|
||||
property bool tempUseSWWW: Settings.useSWWW
|
||||
property bool tempRandomWallpaper: Settings.randomWallpaper
|
||||
property bool tempUseWallpaperTheme: Settings.useWallpaperTheme
|
||||
property int tempWallpaperInterval: Settings.wallpaperInterval
|
||||
property string tempWallpaperResize: Settings.wallpaperResize
|
||||
property int tempTransitionFps: Settings.transitionFps
|
||||
property string tempTransitionType: Settings.transitionType
|
||||
property real tempTransitionDuration: Settings.transitionDuration
|
||||
property bool tempShowSystemInfoInBar: Settings.showSystemInfoInBar
|
||||
property bool tempShowMediaInBar: Settings.showMediaInBar
|
||||
property string tempVisualizerType: Settings.visualizerType
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.backgroundPrimary
|
||||
@@ -145,14 +127,6 @@ PanelWindow {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
anchors.margins: 16
|
||||
weatherCity: (typeof tempWeatherCity !== 'undefined' && tempWeatherCity !== null) ? tempWeatherCity : ""
|
||||
useFahrenheit: tempUseFahrenheit
|
||||
onCityChanged: function (city) {
|
||||
tempWeatherCity = city;
|
||||
}
|
||||
onTemperatureUnitChanged: function (useFahrenheit) {
|
||||
tempUseFahrenheit = useFahrenheit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,22 +138,6 @@ PanelWindow {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
anchors.margins: 16
|
||||
showActiveWindowIcon: tempShowActiveWindowIcon
|
||||
onShowAWIconChanged: function (showActiveWindowIcon) {
|
||||
tempShowActiveWindowIcon = showActiveWindowIcon;
|
||||
}
|
||||
showSystemInfoInBar: tempShowSystemInfoInBar
|
||||
onShowSystemInfoChanged: function (showSystemInfoInBar) {
|
||||
tempShowSystemInfoInBar = showSystemInfoInBar;
|
||||
}
|
||||
showMediaInBar: tempShowMediaInBar
|
||||
onShowMediaChanged: function (showMediaInBar) {
|
||||
tempShowMediaInBar = showMediaInBar;
|
||||
}
|
||||
visualizerType: tempVisualizerType
|
||||
onVisualizerTypeUpdated: function (type) {
|
||||
tempVisualizerType = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,118 +150,15 @@ PanelWindow {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
anchors.margins: 16
|
||||
wallpaperFolder: (typeof tempWallpaperFolder !== 'undefined' && tempWallpaperFolder !== null) ? tempWallpaperFolder : ""
|
||||
useSWWW: tempUseSWWW
|
||||
randomWallpaper: tempRandomWallpaper
|
||||
useWallpaperTheme: tempUseWallpaperTheme
|
||||
wallpaperInterval: tempWallpaperInterval
|
||||
wallpaperResize: tempWallpaperResize
|
||||
transitionFps: tempTransitionFps
|
||||
transitionType: tempTransitionType
|
||||
transitionDuration: tempTransitionDuration
|
||||
onWallpaperFolderEdited: function (folder) {
|
||||
tempWallpaperFolder = folder;
|
||||
}
|
||||
onUseSWWWChangedUpdated: function(useSWWW) {
|
||||
tempUseSWWW = useSWWW;
|
||||
}
|
||||
onRandomWallpaperChangedUpdated: function(randomWallpaper) {
|
||||
tempRandomWallpaper = randomWallpaper;
|
||||
}
|
||||
onUseWallpaperThemeChangedUpdated: function(useWallpaperTheme) {
|
||||
tempUseWallpaperTheme = useWallpaperTheme;
|
||||
}
|
||||
onWallpaperIntervalChangedUpdated: function(wallpaperInterval) {
|
||||
tempWallpaperInterval = wallpaperInterval;
|
||||
}
|
||||
onWallpaperResizeChangedUpdated: function(resize) {
|
||||
tempWallpaperResize = resize;
|
||||
}
|
||||
onTransitionFpsChangedUpdated: function(fps) {
|
||||
tempTransitionFps = fps;
|
||||
}
|
||||
onTransitionTypeChangedUpdated: function(type) {
|
||||
tempTransitionType = type;
|
||||
}
|
||||
onTransitionDurationChangedUpdated: function(duration) {
|
||||
tempTransitionDuration = duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply Button
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 52
|
||||
radius: 16
|
||||
color: applyButtonArea.containsMouse ? Theme.accentPrimary : Theme.accentPrimary
|
||||
border.color: "transparent"
|
||||
border.width: 0
|
||||
opacity: 1.0
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "Apply Changes"
|
||||
font.pixelSize: 17
|
||||
font.bold: true
|
||||
color: applyButtonArea.containsMouse ? Theme.onAccent : Theme.onAccent
|
||||
}
|
||||
MouseArea {
|
||||
id: applyButtonArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
Settings.weatherCity = (typeof tempWeatherCity !== 'undefined' && tempWeatherCity !== null) ? tempWeatherCity : "";
|
||||
Settings.useFahrenheit = tempUseFahrenheit;
|
||||
Settings.profileImage = (typeof tempProfileImage !== 'undefined' && tempProfileImage !== null) ? tempProfileImage : "";
|
||||
Settings.wallpaperFolder = (typeof tempWallpaperFolder !== 'undefined' && tempWallpaperFolder !== null) ? tempWallpaperFolder : "";
|
||||
Settings.showActiveWindowIcon = tempShowActiveWindowIcon;
|
||||
Settings.useSWWW = tempUseSWWW;
|
||||
Settings.randomWallpaper = tempRandomWallpaper;
|
||||
Settings.useWallpaperTheme = tempUseWallpaperTheme;
|
||||
Settings.wallpaperInterval = tempWallpaperInterval;
|
||||
Settings.wallpaperResize = tempWallpaperResize;
|
||||
Settings.transitionFps = tempTransitionFps;
|
||||
Settings.transitionType = tempTransitionType;
|
||||
Settings.transitionDuration = tempTransitionDuration;
|
||||
Settings.showSystemInfoInBar = tempShowSystemInfoInBar;
|
||||
Settings.showMediaInBar = tempShowMediaInBar;
|
||||
Settings.visualizerType = tempVisualizerType;
|
||||
Settings.saveSettings();
|
||||
if (typeof weather !== 'undefined' && weather) {
|
||||
weather.fetchCityWeather();
|
||||
}
|
||||
settingsModal.closeSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Function to open the modal and initialize temp values
|
||||
function openSettings() {
|
||||
tempWeatherCity = (Settings.weatherCity !== undefined && Settings.weatherCity !== null) ? Settings.weatherCity : "";
|
||||
tempUseFahrenheit = Settings.useFahrenheit;
|
||||
tempShowActiveWindowIcon = Settings.showActiveWindowIcon;
|
||||
tempProfileImage = (Settings.profileImage !== undefined && Settings.profileImage !== null) ? Settings.profileImage : "";
|
||||
tempWallpaperFolder = (Settings.wallpaperFolder !== undefined && Settings.wallpaperFolder !== null) ? Settings.wallpaperFolder : "";
|
||||
if (tempWallpaperFolder === undefined || tempWallpaperFolder === null)
|
||||
tempWallpaperFolder = "";
|
||||
|
||||
// Initialize wallpaper settings
|
||||
tempUseSWWW = Settings.useSWWW;
|
||||
tempRandomWallpaper = Settings.randomWallpaper;
|
||||
tempUseWallpaperTheme = Settings.useWallpaperTheme;
|
||||
tempWallpaperInterval = Settings.wallpaperInterval;
|
||||
tempWallpaperResize = Settings.wallpaperResize;
|
||||
tempTransitionFps = Settings.transitionFps;
|
||||
tempTransitionType = Settings.transitionType;
|
||||
tempTransitionDuration = Settings.transitionDuration;
|
||||
tempShowSystemInfoInBar = Settings.showSystemInfoInBar;
|
||||
tempShowMediaInBar = Settings.showMediaInBar;
|
||||
tempVisualizerType = Settings.visualizerType;
|
||||
|
||||
function openSettings() {
|
||||
visible = true;
|
||||
// Force focus on the text input after a short delay
|
||||
focusTimer.start();
|
||||
|
||||
@@ -1,35 +1,15 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import qs.Settings
|
||||
|
||||
Rectangle {
|
||||
id: wallpaperSettingsCard
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 680
|
||||
Layout.topMargin: 12
|
||||
color: Theme.surface
|
||||
radius: 18
|
||||
|
||||
// Property for binding
|
||||
property string wallpaperFolder: ""
|
||||
signal wallpaperFolderEdited(string folder)
|
||||
property bool useSWWW: false
|
||||
signal useSWWWChangedUpdated(bool useSWWW)
|
||||
property bool randomWallpaper: false
|
||||
signal randomWallpaperChangedUpdated(bool randomWallpaper)
|
||||
property bool useWallpaperTheme: false
|
||||
signal useWallpaperThemeChangedUpdated(bool useWallpaperTheme)
|
||||
property int wallpaperInterval: 300
|
||||
signal wallpaperIntervalChangedUpdated(int wallpaperInterval)
|
||||
property string wallpaperResize: "crop"
|
||||
signal wallpaperResizeChangedUpdated(string resize)
|
||||
property int transitionFps: 60
|
||||
signal transitionFpsChangedUpdated(int fps)
|
||||
property string transitionType: "random"
|
||||
signal transitionTypeChangedUpdated(string type)
|
||||
property real transitionDuration: 1.1
|
||||
signal transitionDurationChangedUpdated(real duration)
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@@ -74,7 +54,7 @@ Rectangle {
|
||||
anchors.rightMargin: 12
|
||||
anchors.topMargin: 6
|
||||
anchors.bottomMargin: 6
|
||||
text: wallpaperFolder
|
||||
text: Settings.settings.wallpaperFolder
|
||||
font.family: Theme.fontFamily
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
@@ -84,7 +64,7 @@ Rectangle {
|
||||
activeFocusOnTab: true
|
||||
inputMethodHints: Qt.ImhUrlCharactersOnly
|
||||
onTextChanged: {
|
||||
wallpaperFolderEdited(text)
|
||||
Settings.settings.wallpaperFolder = text
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
@@ -116,8 +96,8 @@ Rectangle {
|
||||
width: 52
|
||||
height: 32
|
||||
radius: 16
|
||||
color: useSWWW ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: useSWWW ? Theme.accentPrimary : Theme.outline
|
||||
color: Settings.settings.useSWWW ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: Settings.settings.useSWWW ? Theme.accentPrimary : Theme.outline
|
||||
border.width: 2
|
||||
|
||||
Rectangle {
|
||||
@@ -129,7 +109,7 @@ Rectangle {
|
||||
border.color: Theme.outline
|
||||
border.width: 1
|
||||
y: 2
|
||||
x: useSWWW ? swwwSwitch.width - width - 2 : 2
|
||||
x: Settings.settings.useSWWW ? swwwSwitch.width - width - 2 : 2
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
@@ -139,7 +119,7 @@ Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
useSWWWChangedUpdated(!useSWWW)
|
||||
Settings.settings.useSWWW = !Settings.settings.useSWWW
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,8 +148,8 @@ Rectangle {
|
||||
width: 52
|
||||
height: 32
|
||||
radius: 16
|
||||
color: randomWallpaper ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: randomWallpaper ? Theme.accentPrimary : Theme.outline
|
||||
color: Settings.settings.randomWallpaper ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: Settings.settings.randomWallpaper ? Theme.accentPrimary : Theme.outline
|
||||
border.width: 2
|
||||
|
||||
Rectangle {
|
||||
@@ -181,7 +161,7 @@ Rectangle {
|
||||
border.color: Theme.outline
|
||||
border.width: 1
|
||||
y: 2
|
||||
x: randomWallpaper ? randomWallpaperSwitch.width - width - 2 : 2
|
||||
x: Settings.settings.randomWallpaper ? randomWallpaperSwitch.width - width - 2 : 2
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
@@ -191,7 +171,7 @@ Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
randomWallpaperChangedUpdated(!randomWallpaper)
|
||||
Settings.settings.randomWallpaper = !Settings.settings.randomWallpaper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,8 +200,8 @@ Rectangle {
|
||||
width: 52
|
||||
height: 32
|
||||
radius: 16
|
||||
color: useWallpaperTheme ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: useWallpaperTheme ? Theme.accentPrimary : Theme.outline
|
||||
color: Settings.settings.useWallpaperTheme ? Theme.accentPrimary : Theme.surfaceVariant
|
||||
border.color: Settings.settings.useWallpaperTheme ? Theme.accentPrimary : Theme.outline
|
||||
border.width: 2
|
||||
|
||||
Rectangle {
|
||||
@@ -233,7 +213,7 @@ Rectangle {
|
||||
border.color: Theme.outline
|
||||
border.width: 1
|
||||
y: 2
|
||||
x: useWallpaperTheme ? wallpaperThemeSwitch.width - width - 2 : 2
|
||||
x: Settings.settings.useWallpaperTheme ? wallpaperThemeSwitch.width - width - 2 : 2
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.OutCubic }
|
||||
@@ -243,7 +223,7 @@ Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
useWallpaperThemeChangedUpdated(!useWallpaperTheme)
|
||||
Settings.settings.useWallpaperTheme = !Settings.settings.useWallpaperTheme
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,7 +249,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: wallpaperInterval
|
||||
text: Settings.settings.wallpaperInterval
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
}
|
||||
@@ -281,7 +261,7 @@ Rectangle {
|
||||
from: 10
|
||||
to: 900
|
||||
stepSize: 10
|
||||
value: wallpaperInterval
|
||||
value: Settings.settings.wallpaperInterval
|
||||
snapMode: Slider.SnapAlways
|
||||
|
||||
background: Rectangle {
|
||||
@@ -314,7 +294,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
onMoved: {
|
||||
wallpaperIntervalChangedUpdated(Math.round(value))
|
||||
Settings.settings.wallpaperInterval = Math.round(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,7 +317,7 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
model: ["no", "crop", "fit", "stretch"]
|
||||
currentIndex: model.indexOf(wallpaperResize)
|
||||
currentIndex: model.indexOf(Settings.settings.wallpaperResize)
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: 120
|
||||
@@ -409,7 +389,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
onActivated: {
|
||||
wallpaperResizeChangedUpdated(model[index])
|
||||
Settings.settings.wallpaperResize = model[index]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,7 +412,7 @@ Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 40
|
||||
model: ["none", "simple", "fade", "left", "right", "top", "bottom", "wipe", "wave", "grow", "center", "any", "outer", "random"]
|
||||
currentIndex: model.indexOf(transitionType)
|
||||
currentIndex: model.indexOf(Settings.settings.transitionType)
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: 120
|
||||
@@ -504,7 +484,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
onActivated: {
|
||||
transitionTypeChangedUpdated(model[index])
|
||||
Settings.settings.transitionType = model[index]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -529,7 +509,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: transitionFps
|
||||
text: Settings.settings.transitionFps
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
}
|
||||
@@ -541,7 +521,7 @@ Rectangle {
|
||||
from: 30
|
||||
to: 500
|
||||
stepSize: 5
|
||||
value: transitionFps
|
||||
value: Settings.settings.transitionFps
|
||||
snapMode: Slider.SnapAlways
|
||||
|
||||
background: Rectangle {
|
||||
@@ -574,7 +554,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
onMoved: {
|
||||
transitionFpsChangedUpdated(Math.round(value))
|
||||
Settings.settings.transitionFps = Math.round(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -599,7 +579,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: transitionDuration.toFixed(3)
|
||||
text: Settings.settings.transitionDuration.toFixed(3)
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
}
|
||||
@@ -611,7 +591,7 @@ Rectangle {
|
||||
from: 0.250
|
||||
to: 10.0
|
||||
stepSize: 0.050
|
||||
value: transitionDuration
|
||||
value: Settings.settings.transitionDuration
|
||||
snapMode: Slider.SnapAlways
|
||||
|
||||
background: Rectangle {
|
||||
@@ -644,7 +624,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
onMoved: {
|
||||
transitionDurationChangedUpdated(value)
|
||||
Settings.settings.transitionDuration = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.Settings
|
||||
|
||||
Rectangle {
|
||||
id: weatherSettingsCard
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 180
|
||||
Layout.topMargin: 12
|
||||
color: Theme.surface
|
||||
radius: 18
|
||||
|
||||
// Properties for binding
|
||||
property string weatherCity: ""
|
||||
property bool useFahrenheit: false
|
||||
|
||||
signal cityChanged(string city)
|
||||
signal temperatureUnitChanged(bool useFahrenheit)
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 18
|
||||
@@ -76,7 +67,7 @@ Rectangle {
|
||||
anchors.rightMargin: 12
|
||||
anchors.topMargin: 6
|
||||
anchors.bottomMargin: 6
|
||||
text: weatherCity
|
||||
text: Settings.settings.weatherCity
|
||||
font.family: Theme.fontFamily
|
||||
font.pixelSize: 13
|
||||
color: Theme.textPrimary
|
||||
@@ -88,7 +79,7 @@ Rectangle {
|
||||
inputMethodHints: Qt.ImhNone
|
||||
|
||||
onTextChanged: {
|
||||
cityChanged(text)
|
||||
Settings.settings.weatherCity = text
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -137,11 +128,11 @@ Rectangle {
|
||||
border.color: Theme.outline
|
||||
border.width: 1
|
||||
y: 2
|
||||
x: useFahrenheit ? customSwitch.width - width - 2 : 2
|
||||
x: Settings.settings.useFahrenheit ? customSwitch.width - width - 2 : 2
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: useFahrenheit ? "\u00b0F" : "\u00b0C"
|
||||
text: Settings.settings.useFahrenheit ? "\u00b0F" : "\u00b0C"
|
||||
font.family: Theme.fontFamily
|
||||
font.pixelSize: 12
|
||||
font.bold: true
|
||||
@@ -156,7 +147,7 @@ Rectangle {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
temperatureUnitChanged(!useFahrenheit)
|
||||
Settings.settings.useFahrenheit = !Settings.settings.useFahrenheit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user