Merge pull request #567 from MrDowntempo/fix/small-alignment

Fix/small alignment
This commit is contained in:
Lemmy
2025-10-24 15:10:46 -04:00
committed by GitHub
3 changed files with 23 additions and 35 deletions
@@ -50,17 +50,12 @@ ColumnLayout {
Layout.fillWidth: true
spacing: Style.marginS
NTextInput {
NTextInputButton {
id: newRuleInput
Layout.fillWidth: true
placeholderText: I18n.tr("settings.bar.tray.blacklist.placeholder")
}
NIconButton {
Layout.alignment: Qt.AlignVCenter
icon: "add"
baseSize: Style.baseWidgetSize * 0.8
onClicked: {
buttonIcon: "add"
onButtonClicked: {
if (newRuleInput.text.length > 0) {
var newRule = newRuleInput.text.trim()
var exists = false
@@ -72,13 +67,12 @@ ColumnLayout {
}
if (!exists) {
blacklistModel.append({
"rule": newRule
})
"rule": newRule
})
newRuleInput.text = ""
}
}
}
enabled: newRuleInput.text.length > 0
}
}
}
+16 -24
View File
@@ -252,36 +252,28 @@ ColumnLayout {
spacing: Style.marginS
Layout.fillWidth: true
RowLayout {
spacing: Style.marginS
NTextInputButton {
id: blacklistInput
label: I18n.tr("settings.audio.media.excluded-player.label")
description: I18n.tr("settings.audio.media.excluded-player.description")
placeholderText: I18n.tr("settings.audio.media.excluded-player.placeholder")
buttonIcon: "add"
Layout.fillWidth: true
NTextInput {
id: blacklistInput
label: I18n.tr("settings.audio.media.excluded-player.label")
description: I18n.tr("settings.audio.media.excluded-player.description")
placeholderText: I18n.tr("settings.audio.media.excluded-player.placeholder")
}
// Button aligned to the center of the actual input field
NIconButton {
icon: "add"
Layout.alignment: Qt.AlignBottom
Layout.bottomMargin: blacklistInput.description ? Style.marginS : 0
onClicked: {
const val = (blacklistInput.text || "").trim()
if (val !== "") {
const arr = (Settings.data.audio.mprisBlacklist || [])
if (!arr.find(x => String(x).toLowerCase() === val.toLowerCase())) {
Settings.data.audio.mprisBlacklist = [...arr, val]
blacklistInput.text = ""
MediaService.updateCurrentPlayer()
}
onButtonClicked: {
const val = (blacklistInput.text || "").trim()
if (val !== "") {
const arr = (Settings.data.audio.mprisBlacklist || [])
if (!arr.find(x => String(x).toLowerCase() === val.toLowerCase())) {
Settings.data.audio.mprisBlacklist = [...arr, val]
blacklistInput.text = ""
MediaService.updateCurrentPlayer()
}
}
}
}
// Current blacklist entries
Flow {
Layout.fillWidth: true
+2
View File
@@ -12,6 +12,7 @@ ColumnLayout {
property alias placeholderText: input.placeholderText
property string label: ""
property string description: ""
property string inputIconName: ""
property alias buttonIcon: button.icon
property alias buttonTooltip: button.tooltipText
property alias buttonEnabled: button.enabled
@@ -38,6 +39,7 @@ ColumnLayout {
NTextInput {
id: input
inputIconName: root.inputIconName
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
onTextChanged: root.inputTextChanged(text)