diff --git a/Components/CustomSlider.qml b/Components/CustomSlider.qml index 4592f9c..311f861 100644 --- a/Components/CustomSlider.qml +++ b/Components/CustomSlider.qml @@ -10,31 +10,35 @@ Slider { background: Item { CustomRect { anchors.bottom: parent.bottom + anchors.bottomMargin: root.implicitHeight / 6 anchors.left: parent.left anchors.top: parent.top + anchors.topMargin: root.implicitHeight / 6 bottomRightRadius: root.implicitHeight / 6 color: root.color - implicitWidth: root.handle.x - root.implicitHeight / 2 - radius: Appearance.rounding.full + implicitWidth: root.handle.x - root.implicitHeight / 6 + radius: root.implicitHeight / 6 topRightRadius: root.implicitHeight / 6 } CustomRect { anchors.bottom: parent.bottom + anchors.bottomMargin: root.implicitHeight / 6 anchors.right: parent.right anchors.top: parent.top + anchors.topMargin: root.implicitHeight / 6 bottomLeftRadius: root.implicitHeight / 6 - color: DynamicColors.tPalette.m3surfaceContainer - implicitWidth: parent.width - root.handle.x - root.handle.implicitWidth - root.implicitHeight / 2 - radius: Appearance.rounding.full + color: DynamicColors.tPalette.m3surfaceContainerHighest + implicitWidth: parent.width - root.handle.x - root.handle.implicitWidth - root.implicitHeight / 6 + radius: root.implicitHeight / 6 topLeftRadius: root.implicitHeight / 6 } } handle: CustomRect { anchors.verticalCenter: parent.verticalCenter color: root.color - implicitHeight: 15 - implicitWidth: 5 + implicitHeight: root.implicitHeight + implicitWidth: root.implicitHeight / 4.5 radius: Appearance.rounding.full x: root.visualPosition * root.availableWidth - implicitWidth / 2 diff --git a/Daemons/Battery.qml b/Daemons/Battery.qml index be318a2..446fc58 100644 --- a/Daemons/Battery.qml +++ b/Daemons/Battery.qml @@ -14,7 +14,6 @@ Scope { function nearestThresholdAbove(p: real): var { const thresholds = [...root.popupThresholds]; for (const perc of thresholds) { - console.log(perc.message); if (p < perc.perc) return perc; } diff --git a/Modules/Settings/Controls/WallpaperCropper.qml b/Modules/Settings/Controls/WallpaperCropper.qml index efe7cc6..f3da6f1 100644 --- a/Modules/Settings/Controls/WallpaperCropper.qml +++ b/Modules/Settings/Controls/WallpaperCropper.qml @@ -80,26 +80,28 @@ Item { required property ShellScreen modelData function applyCrop(): void { - if (!cropRectLoader.item) return; + if (!cropRectLoader.item) + return; const cropRect = cropRectLoader.item; - - // We need to calculate the exact percentage coordinates that map perfectly + + // We need to calculate the exact percentage coordinates that map perfectly // to our C++ backend, regardless of current display scaling const cropXPercent = (cropRect.x - cropRect.imageX) / scaledImg.paintedWidth; const cropYPercent = (cropRect.y - cropRect.imageY) / scaledImg.paintedHeight; const cropWidthPercent = cropRect.width / scaledImg.paintedWidth; const cropHeightPercent = cropRect.height / scaledImg.paintedHeight; - + const finalRect = Qt.rect(cropXPercent, cropYPercent, cropWidthPercent, cropHeightPercent); - + // We just pass the percentages directly to the backend Wallpapers.setCrop(delegate.modelData.name, finalRect, finalRect, cropRect.zoom); } function zoomClipRect(zoom: real): void { - if (!cropRectLoader.item) return; + if (!cropRectLoader.item) + return; const cropRect = cropRectLoader.item; - + let oldCenterX = cropRect.x + cropRect.width * 0.5; let oldCenterY = cropRect.y + cropRect.height * 0.5; @@ -139,8 +141,9 @@ Item { id: zoomSlider Layout.fillWidth: true - Layout.preferredHeight: 10 + Layout.preferredHeight: 30 from: 1.0 + implicitHeight: 30 to: 5.0 value: cropRectLoader.item ? cropRectLoader.item.zoom : 1.0 @@ -198,8 +201,9 @@ Item { Loader { id: cropRectLoader + active: scaledImg.paintedWidth > 0 && scaledImg.status == Image.Ready - + sourceComponent: Component { CustomRect { id: cropRect @@ -240,7 +244,7 @@ Item { zoom = data.zoom > 0 ? data.zoom : 1.0; x = imageX + (data.x * scaledImg.paintedWidth); y = imageY + (data.y * scaledImg.paintedHeight); - + clampToBounds(); } else { zoom = 1.0; @@ -272,9 +276,10 @@ Item { id: mouse function updateCrop(mouseX, mouseY) { - if (!cropRectLoader.item) return; + if (!cropRectLoader.item) + return; const cropRect = cropRectLoader.item; - + let nx = mouseX - cropRect.width * 0.5; let ny = mouseY - cropRect.height * 0.5; diff --git a/Modules/SysTray/Popouts/AudioPopup.qml b/Modules/SysTray/Popouts/AudioPopup.qml index 5ef8644..9d2d92b 100644 --- a/Modules/SysTray/Popouts/AudioPopup.qml +++ b/Modules/SysTray/Popouts/AudioPopup.qml @@ -52,25 +52,25 @@ Item { CustomRect { Layout.fillWidth: true - Layout.preferredHeight: 42 + Appearance.spacing.smaller * 2 + Layout.preferredHeight: 50 + Appearance.spacing.smaller * 2 Layout.topMargin: root.topMargin color: DynamicColors.tPalette.m3surfaceContainer radius: root.rounding - RowLayout { - id: outputVolume + Item { + id: sinkIcon + anchors.bottom: parent.bottom anchors.left: parent.left - anchors.margins: Appearance.spacing.smaller - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - spacing: 15 + anchors.leftMargin: Appearance.padding.normal + anchors.top: parent.top + implicitWidth: childrenRect.width CustomRect { - Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: 40 - Layout.preferredWidth: 40 + anchors.centerIn: parent color: Audio.muted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary + implicitHeight: 40 + implicitWidth: 40 radius: Appearance.rounding.full MaterialIcon { @@ -92,45 +92,53 @@ Item { } } } + } - ColumnLayout { + ColumnLayout { + anchors.bottom: parent.bottom + anchors.bottomMargin: Appearance.padding.smallest + anchors.left: sinkIcon.right + anchors.leftMargin: Appearance.spacing.normal + anchors.right: parent.right + anchors.rightMargin: Appearance.padding.large + anchors.top: parent.top + anchors.topMargin: Appearance.padding.smaller + + RowLayout { + Layout.fillHeight: true Layout.fillWidth: true - RowLayout { + CustomText { + Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.fillWidth: true - - CustomText { - Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - Layout.fillWidth: true - text: "Output Volume" - } - - CustomText { - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - font.bold: true - text: qsTr("%1").arg(Audio.muted ? qsTr("Muted") : `${Math.round(Audio.volume * 100)}%`) - } + text: "Output Volume" } - CustomMouseArea { - Layout.bottomMargin: 5 - Layout.fillWidth: true - Layout.preferredHeight: 10 + CustomText { + Layout.alignment: Qt.AlignVCenter | Qt.AlignRight + font.bold: true + text: qsTr("%1").arg(Audio.muted ? qsTr("Muted") : `${Math.round(Audio.volume * 100)}%`) + } + } - CustomSlider { - anchors.left: parent.left - anchors.right: parent.right - color: Audio.muted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary - implicitHeight: 10 - value: Audio.volume + CustomMouseArea { + Layout.bottomMargin: 5 + Layout.fillHeight: true + Layout.fillWidth: true - Behavior on value { - Anim { - } + CustomSlider { + anchors.left: parent.left + anchors.right: parent.right + color: Audio.muted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary + implicitHeight: parent.height + value: Audio.volume + + Behavior on value { + Anim { } - - onMoved: Audio.setVolume(value) } + + onMoved: Audio.setVolume(value) } } } @@ -138,7 +146,7 @@ Item { CustomClippingRect { Layout.fillWidth: true - Layout.preferredHeight: 42 + Appearance.spacing.smaller * 2 + Layout.preferredHeight: 50 + Appearance.spacing.smaller * 2 Layout.topMargin: root.topMargin color: DynamicColors.tPalette.m3surfaceContainer radius: root.rounding @@ -165,20 +173,20 @@ Item { } } - RowLayout { - id: inputVolume + Item { + id: sourceIcon + anchors.bottom: parent.bottom anchors.left: parent.left - anchors.margins: Appearance.spacing.smaller - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - spacing: 15 + anchors.leftMargin: Appearance.padding.normal + anchors.top: parent.top + implicitWidth: childrenRect.width CustomRect { - Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: 40 - Layout.preferredWidth: 40 + anchors.centerIn: parent color: Audio.sourceMuted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary + implicitHeight: 40 + implicitWidth: 40 radius: Appearance.rounding.full MaterialIcon { @@ -200,46 +208,53 @@ Item { } } } + } - ColumnLayout { + ColumnLayout { + anchors.bottom: parent.bottom + anchors.bottomMargin: Appearance.padding.smallest + anchors.left: sourceIcon.right + anchors.leftMargin: Appearance.spacing.normal + anchors.right: parent.right + anchors.rightMargin: Appearance.padding.large + anchors.top: parent.top + anchors.topMargin: Appearance.padding.smaller + + RowLayout { + Layout.fillHeight: true Layout.fillWidth: true - RowLayout { - Layout.fillHeight: true + CustomText { + Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.fillWidth: true - - CustomText { - Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - Layout.fillWidth: true - text: "Input Volume" - } - - CustomText { - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - font.bold: true - text: qsTr("%1").arg(Audio.sourceMuted ? qsTr("Muted") : `${Math.round(Audio.sourceVolume * 100)}%`) - } + text: "Input Volume" } - CustomMouseArea { - Layout.bottomMargin: 5 - Layout.fillWidth: true - implicitHeight: 10 + CustomText { + Layout.alignment: Qt.AlignVCenter | Qt.AlignRight + font.bold: true + text: qsTr("%1").arg(Audio.sourceMuted ? qsTr("Muted") : `${Math.round(Audio.sourceVolume * 100)}%`) + } + } - CustomSlider { - anchors.left: parent.left - anchors.right: parent.right - color: Audio.sourceMuted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary - implicitHeight: 10 - value: Audio.sourceVolume + CustomMouseArea { + Layout.bottomMargin: 5 + Layout.fillHeight: true + Layout.fillWidth: true - Behavior on value { - Anim { - } + CustomSlider { + anchors.left: parent.left + anchors.right: parent.right + color: Audio.sourceMuted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary + implicitHeight: parent.height + value: Audio.sourceVolume + + Behavior on value { + Anim { } - - onMoved: Audio.setSourceVolume(value) } + + onMoved: Audio.setSourceVolume(value) } } } @@ -265,7 +280,7 @@ Item { required property var modelData Layout.fillWidth: true - Layout.preferredHeight: 42 + Appearance.spacing.smaller * 2 + Layout.preferredHeight: 50 + Appearance.spacing.smaller * 2 Layout.topMargin: root.topMargin color: DynamicColors.tPalette.m3surfaceContainer radius: root.rounding @@ -292,18 +307,20 @@ Item { } } - RowLayout { - id: layoutVolume + Item { + id: appBoxIcon - anchors.fill: parent - anchors.margins: Appearance.spacing.smaller - spacing: 15 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.leftMargin: Appearance.padding.normal + anchors.top: parent.top + implicitWidth: childrenRect.width CustomRect { - Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: 40 - Layout.preferredWidth: 40 + anchors.centerIn: parent color: appBox.modelData.audio.muted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary + implicitHeight: 40 + implicitWidth: 40 radius: Appearance.rounding.full MaterialIcon { @@ -325,55 +342,58 @@ Item { } } } + } - ColumnLayout { - Layout.alignment: Qt.AlignLeft | Qt.AlignTop + TextMetrics { + id: metrics + + elide: Text.ElideRight + elideWidth: root.width - 50 + text: Audio.getStreamName(appBox.modelData) + } + + ColumnLayout { + anchors.bottom: parent.bottom + anchors.bottomMargin: Appearance.padding.smallest + anchors.left: appBoxIcon.right + anchors.leftMargin: Appearance.spacing.normal + anchors.right: parent.right + anchors.rightMargin: Appearance.padding.large + anchors.top: parent.top + anchors.topMargin: Appearance.padding.smaller + + RowLayout { Layout.fillHeight: true + Layout.fillWidth: true - TextMetrics { - id: metrics - - elide: Text.ElideRight - elideWidth: root.width - 50 - text: Audio.getStreamName(appBox.modelData) - } - - RowLayout { - Layout.fillHeight: true - Layout.fillWidth: true - - CustomText { - Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - Layout.fillHeight: true - Layout.fillWidth: true - elide: Text.ElideRight - text: metrics.elidedText - } - - CustomText { - Layout.alignment: Qt.AlignVCenter | Qt.AlignRight - Layout.fillHeight: true - font.bold: true - text: qsTr("%1").arg(appBox.modelData.audio.muted ? qsTr("Muted") : `${Math.round(appBox.modelData.audio.volume * 100)}%`) - } - } - - CustomMouseArea { + CustomText { Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - Layout.fillHeight: true Layout.fillWidth: true - implicitHeight: 10 + elide: Text.ElideRight + text: metrics.elidedText + } - CustomSlider { - anchors.left: parent.left - anchors.right: parent.right - color: appBox.modelData.audio.muted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary - implicitHeight: 10 - value: appBox.modelData.audio.volume + CustomText { + Layout.alignment: Qt.AlignVCenter | Qt.AlignRight + font.bold: true + text: qsTr("%1").arg(appBox.modelData.audio.muted ? qsTr("Muted") : `${Math.round(appBox.modelData.audio.volume * 100)}%`) + } + } - onMoved: { - Audio.setStreamVolume(appBox.modelData, value); - } + CustomMouseArea { + Layout.bottomMargin: 5 + Layout.fillHeight: true + Layout.fillWidth: true + + CustomSlider { + anchors.left: parent.left + anchors.right: parent.right + color: appBox.modelData.audio.muted ? DynamicColors.palette.m3error : DynamicColors.palette.m3primary + implicitHeight: parent.height + value: appBox.modelData.audio.volume + + onMoved: { + Audio.setStreamVolume(appBox.modelData, value); } } }