1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-16 17:22:45 -04:00

text: change default rendering back to Qt

This commit is contained in:
bbedward
2026-05-15 09:45:10 -04:00
parent 0a892a4a9e
commit 1c1ab1c7d5
50 changed files with 520 additions and 496 deletions
@@ -1,5 +1,4 @@
import QtQuick
import QtQuick.Effects
import Quickshell
import qs.Common
import qs.Widgets
@@ -22,11 +21,11 @@ Card {
StyledText {
text: {
if (SettingsData.use24HourClock) {
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(0)
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(0);
} else {
const hours = systemClock?.date?.getHours()
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours
return String(display).padStart(2, '0').charAt(0)
const hours = systemClock?.date?.getHours();
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
return String(display).padStart(2, '0').charAt(0);
}
}
font.pixelSize: 48
@@ -39,11 +38,11 @@ Card {
StyledText {
text: {
if (SettingsData.use24HourClock) {
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(1)
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(1);
} else {
const hours = systemClock?.date?.getHours()
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours
return String(display).padStart(2, '0').charAt(1)
const hours = systemClock?.date?.getHours();
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
return String(display).padStart(2, '0').charAt(1);
}
}
font.pixelSize: 48
@@ -1,6 +1,4 @@
import QtQuick
import QtQuick.Effects
import QtQuick.Shapes
import Quickshell.Services.Mpris
import qs.Common
import qs.Services
@@ -10,24 +8,25 @@ Card {
id: root
clip: false
signal clicked()
signal clicked
property MprisPlayer activePlayer: MprisController.activePlayer
property real currentPosition: activePlayer?.positionSupported ? activePlayer.position : 0
property real displayPosition: currentPosition
readonly property real ratio: {
if (!activePlayer || activePlayer.length <= 0) return 0
const pos = displayPosition % Math.max(1, activePlayer.length)
const calculatedRatio = pos / activePlayer.length
return Math.max(0, Math.min(1, calculatedRatio))
if (!activePlayer || activePlayer.length <= 0)
return 0;
const pos = displayPosition % Math.max(1, activePlayer.length);
const calculatedRatio = pos / activePlayer.length;
return Math.max(0, Math.min(1, calculatedRatio));
}
onActivePlayerChanged: {
if (activePlayer?.positionSupported) {
currentPosition = Qt.binding(() => activePlayer?.position || 0)
currentPosition = Qt.binding(() => activePlayer?.position || 0);
} else {
currentPosition = 0
currentPosition = 0;
}
}
@@ -126,73 +125,73 @@ Card {
spacing: Theme.spacingS
anchors.centerIn: parent
Rectangle {
width: 28
height: 28
radius: 14
anchors.verticalCenter: playPauseButton.verticalCenter
color: prevArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
Rectangle {
width: 28
height: 28
radius: 14
anchors.verticalCenter: playPauseButton.verticalCenter
color: prevArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
DankIcon {
anchors.centerIn: parent
name: "skip_previous"
size: 14
color: Theme.surfaceText
DankIcon {
anchors.centerIn: parent
name: "skip_previous"
size: 14
color: Theme.surfaceText
}
MouseArea {
id: prevArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: MprisController.previousOrRewind()
}
}
MouseArea {
id: prevArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: MprisController.previousOrRewind()
}
}
Rectangle {
id: playPauseButton
width: 32
height: 32
radius: 16
color: Theme.primary
Rectangle {
id: playPauseButton
width: 32
height: 32
radius: 16
color: Theme.primary
DankIcon {
anchors.centerIn: parent
name: activePlayer?.playbackState === MprisPlaybackState.Playing ? "pause" : "play_arrow"
size: 16
color: Theme.background
}
DankIcon {
anchors.centerIn: parent
name: activePlayer?.playbackState === MprisPlaybackState.Playing ? "pause" : "play_arrow"
size: 16
color: Theme.background
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: activePlayer?.togglePlaying()
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: activePlayer?.togglePlaying()
}
}
Rectangle {
width: 28
height: 28
radius: 14
anchors.verticalCenter: playPauseButton.verticalCenter
color: nextArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
Rectangle {
width: 28
height: 28
radius: 14
anchors.verticalCenter: playPauseButton.verticalCenter
color: nextArea.containsMouse ? Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) : "transparent"
DankIcon {
anchors.centerIn: parent
name: "skip_next"
size: 14
color: Theme.surfaceText
}
DankIcon {
anchors.centerIn: parent
name: "skip_next"
size: 14
color: Theme.surfaceText
MouseArea {
id: nextArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: activePlayer?.next()
}
}
MouseArea {
id: nextArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: activePlayer?.next()
}
}
}
}
}
+1 -5
View File
@@ -538,11 +538,7 @@ Item {
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: wallpaperFolderModel.count > 0
? (wallpaperFolderModel.count === 1
? I18n.tr("%1 wallpaper • %2 / %3").arg(wallpaperFolderModel.count).arg(currentPage + 1).arg(totalPages)
: I18n.tr("%1 wallpapers • %2 / %3").arg(wallpaperFolderModel.count).arg(currentPage + 1).arg(totalPages))
: I18n.tr("No wallpapers")
text: wallpaperFolderModel.count > 0 ? (wallpaperFolderModel.count === 1 ? I18n.tr("%1 wallpaper • %2 / %3").arg(wallpaperFolderModel.count).arg(currentPage + 1).arg(totalPages) : I18n.tr("%1 wallpapers • %2 / %3").arg(wallpaperFolderModel.count).arg(currentPage + 1).arg(totalPages)) : I18n.tr("No wallpapers")
font.pixelSize: 14
color: Theme.surfaceText
opacity: 0.7