Fix NWidgetCard

This commit is contained in:
LemmyCook 2025-08-22 17:57:55 -04:00
parent 017813ab57
commit 2a6ad0819f
7 changed files with 34 additions and 37 deletions

View file

@ -11,8 +11,8 @@ Row {
id: root id: root
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
visible: MediaService.currentPlayer !== null visible: MediaService.currentPlayer !== null && MediaService.canPlay
width: MediaService.currentPlayer !== null ? implicitWidth : 0 width: MediaService.currentPlayer !== null && MediaService.canPlay ? implicitWidth : 0
function getTitle() { function getTitle() {
return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "") return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "")

View file

@ -27,24 +27,25 @@ NIconButton {
} }
function profileName() { function profileName() {
if (!hasPP) if (!hasPP)
return "Unknown" return "Unknown"
if (powerProfiles.profile === PowerProfile.Performance) if (powerProfiles.profile === PowerProfile.Performance)
return "Performance" return "Performance"
if (powerProfiles.profile === PowerProfile.Balanced) if (powerProfiles.profile === PowerProfile.Balanced)
return "Balanced" return "Balanced"
if (powerProfiles.profile === PowerProfile.PowerSaver) if (powerProfiles.profile === PowerProfile.PowerSaver)
return "Power Saver" return "Power Saver"
} }
function changeProfile() { function changeProfile() {
if (!hasPP) return; if (!hasPP)
if (powerProfiles.profile === PowerProfile.Performance) return
powerProfiles.profile = PowerProfile.PowerSaver if (powerProfiles.profile === PowerProfile.Performance)
else if (powerProfiles.profile === PowerProfile.Balanced) powerProfiles.profile = PowerProfile.PowerSaver
powerProfiles.profile = PowerProfile.Performance else if (powerProfiles.profile === PowerProfile.Balanced)
else if (powerProfiles.profile === PowerProfile.PowerSaver) powerProfiles.profile = PowerProfile.Performance
powerProfiles.profile = PowerProfile.Balanced else if (powerProfiles.profile === PowerProfile.PowerSaver)
powerProfiles.profile = PowerProfile.Balanced
} }
icon: root.profileIcon() icon: root.profileIcon()

View file

@ -344,8 +344,8 @@ ColumnLayout {
} }
currentKey: Settings.data.audio.cavaFrameRate currentKey: Settings.data.audio.cavaFrameRate
onSelected: key => { onSelected: key => {
Settings.data.audio.cavaFrameRate = key Settings.data.audio.cavaFrameRate = key
} }
} }
} }
} }

View file

@ -33,7 +33,6 @@ ColumnLayout {
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
Layout.fillWidth: true Layout.fillWidth: true
ColumnLayout { ColumnLayout {
spacing: Style.marginXXS * scaling spacing: Style.marginXXS * scaling
Layout.fillWidth: true Layout.fillWidth: true
@ -72,7 +71,7 @@ ColumnLayout {
} }
} }
ColumnLayout { ColumnLayout {
spacing: Style.marginXXS * scaling spacing: Style.marginXXS * scaling
Layout.fillWidth: true Layout.fillWidth: true
@ -111,7 +110,6 @@ ColumnLayout {
} }
} }
NToggle { NToggle {
label: "Show Active Window's Icon" label: "Show Active Window's Icon"
description: "Display the app icon next to the title of the currently focused window." description: "Display the app icon next to the title of the currently focused window."
@ -130,7 +128,6 @@ ColumnLayout {
} }
} }
NDivider { NDivider {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: Style.marginL * scaling Layout.topMargin: Style.marginL * scaling

View file

@ -160,8 +160,6 @@ NBox {
height: 90 * scaling height: 90 * scaling
radius: width * 0.5 radius: width * 0.5
color: trackArt.visible ? Color.mPrimary : Color.transparent color: trackArt.visible ? Color.mPrimary : Color.transparent
border.color: trackArt.visible ? Color.mOutline : Color.transparent
border.width: Math.max(1, Style.borderS * scaling)
clip: true clip: true
NImageCircled { NImageCircled {

View file

@ -15,7 +15,7 @@ ColumnLayout {
property ListModel model: { property ListModel model: {
} }
property string currentKey: '' property string currentKey: ""
property string placeholder: "" property string placeholder: ""
signal selected(string key) signal selected(string key)

View file

@ -58,23 +58,24 @@ NCard {
description: "" description: ""
placeholder: "Add widget to " + sectionName.toLowerCase() + " section" placeholder: "Add widget to " + sectionName.toLowerCase() + " section"
onSelected: key => { onSelected: key => {
comboBox.selectedKey = key comboBox.currentKey = key
} }
Layout.alignment: Qt.AlignVCenter
} }
NIconButton { NIconButton {
icon: "add" icon: "add"
size: 24 * scaling
colorBg: Color.mPrimary colorBg: Color.mPrimary
colorFg: Color.mOnPrimary colorFg: Color.mOnPrimary
colorBgHover: Color.mPrimaryContainer colorBgHover: Color.mSecondary
colorFgHover: Color.mOnPrimaryContainer colorFgHover: Color.mOnSecondary
enabled: comboBox.selectedKey !== "" enabled: comboBox.selectedKey !== ""
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
onClicked: { onClicked: {
if (comboBox.selectedKey !== "") { if (comboBox.currentKey !== "") {
addWidget(comboBox.selectedKey, sectionName.toLowerCase()) addWidget(comboBox.currentKey, sectionName.toLowerCase())
comboBox.reset() comboBox.currentKey = ""
} }
} }
} }