mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-03 10:56:16 +00:00
committing files that won't stack
This commit is contained in:
@@ -30,11 +30,14 @@ Rectangle {
|
||||
readonly property string barPosition: Settings.data.bar.position
|
||||
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
|
||||
|
||||
readonly property string iconStyle: (widgetSettings.indicatorStyle !== undefined) ? widgetSettings.indicatorStyle : widgetMetadata.indicatorStyle
|
||||
readonly property bool showCaps: (widgetSettings.showCapsLock !== undefined) ? widgetSettings.showCapsLock : widgetMetadata.showCapsLock
|
||||
readonly property bool showNum: (widgetSettings.showNumLock !== undefined) ? widgetSettings.showNumLock : widgetMetadata.showNumLock
|
||||
readonly property bool showScroll: (widgetSettings.showScrollLock !== undefined) ? widgetSettings.showScrollLock : widgetMetadata.showScrollLock
|
||||
|
||||
readonly property string capsIcon: widgetSettings.capsLockIcon !== undefined ? widgetSettings.capsLockIcon : widgetMetadata.capsLockIcon
|
||||
readonly property string numIcon: widgetSettings.numLockIcon !== undefined ? widgetSettings.numLockIcon : widgetMetadata.numLockIcon
|
||||
readonly property string scrollIcon: widgetSettings.scrollLockIcon !== undefined ? widgetSettings.scrollLockIcon : widgetMetadata.scrollLockIcon
|
||||
|
||||
implicitWidth: isVertical ? Style.capsuleHeight : Math.round(layout.implicitWidth + Style.marginM * 2)
|
||||
implicitHeight: isVertical ? Math.round(layout.implicitHeight + Style.marginM * 2) : Style.capsuleHeight
|
||||
|
||||
@@ -51,8 +54,6 @@ Rectangle {
|
||||
implicitWidth: rowLayout.visible ? rowLayout.implicitWidth : colLayout.implicitWidth
|
||||
implicitHeight: rowLayout.visible ? rowLayout.implicitHeight : colLayout.implicitHeight
|
||||
|
||||
readonly property var indicatorStyle: root.getIndicatorStyle(root.iconStyle)
|
||||
|
||||
RowLayout {
|
||||
id: rowLayout
|
||||
visible: !root.isVertical
|
||||
@@ -60,17 +61,17 @@ Rectangle {
|
||||
|
||||
NIcon {
|
||||
visible: root.showCaps
|
||||
icon: layout.indicatorStyle[0]
|
||||
icon: root.capsIcon
|
||||
color: LockKeysService.capsLockOn ? Color.mTertiary : Qt.alpha(Color.mOnSurfaceVariant, 0.3)
|
||||
}
|
||||
NIcon {
|
||||
visible: root.showNum
|
||||
icon: layout.indicatorStyle[1]
|
||||
icon: root.numIcon
|
||||
color: LockKeysService.numLockOn ? Color.mTertiary : Qt.alpha(Color.mOnSurfaceVariant, 0.3)
|
||||
}
|
||||
NIcon {
|
||||
visible: root.showScroll
|
||||
icon: layout.indicatorStyle[2]
|
||||
icon: root.scrollIcon
|
||||
color: LockKeysService.scrollLockOn ? Color.mTertiary : Qt.alpha(Color.mOnSurfaceVariant, 0.3)
|
||||
}
|
||||
}
|
||||
@@ -82,42 +83,19 @@ Rectangle {
|
||||
|
||||
NIcon {
|
||||
visible: root.showCaps
|
||||
icon: layout.indicatorStyle[0]
|
||||
icon: root.capsIcon
|
||||
color: LockKeysService.capsLockOn ? Color.mTertiary : Qt.alpha(Color.mOnSurfaceVariant, 0.3)
|
||||
}
|
||||
NIcon {
|
||||
visible: root.showNum
|
||||
icon: layout.indicatorStyle[1]
|
||||
icon: root.numIcon
|
||||
color: LockKeysService.numLockOn ? Color.mTertiary : Qt.alpha(Color.mOnSurfaceVariant, 0.3)
|
||||
}
|
||||
NIcon {
|
||||
visible: root.showScroll
|
||||
icon: layout.indicatorStyle[2]
|
||||
icon: root.scrollIcon
|
||||
color: LockKeysService.scrollLockOn ? Color.mTertiary : Qt.alpha(Color.mOnSurfaceVariant, 0.3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getIndicatorStyle(styleName) {
|
||||
switch (styleName) {
|
||||
case "large":
|
||||
return ["letter-c", "letter-n", "letter-s"]
|
||||
case "small":
|
||||
return ["letter-c-small", "letter-n-small", "letter-s-small"]
|
||||
case "square":
|
||||
return ["square-letter-c", "square-letter-n", "square-letter-s"]
|
||||
case "square-round":
|
||||
return ["square-rounded-letter-c", "square-rounded-letter-n", "square-rounded-letter-s"]
|
||||
case "circle":
|
||||
return ["circle-letter-c", "circle-letter-n", "circle-letter-s"]
|
||||
case "circle-dash":
|
||||
return ["circle-dashed-letter-c", "circle-dashed-letter-n", "circle-dashed-letter-s"]
|
||||
case "circle-dot":
|
||||
return ["circle-dotted-letter-c", "circle-dotted-letter-n", "circle-dotted-letter-s"]
|
||||
case "hex":
|
||||
return ["hexagon-letter-c", "hexagon-letter-n", "hexagon-letter-s"]
|
||||
default:
|
||||
return ["letter-c", "letter-n", "letter-s"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,71 +14,121 @@ ColumnLayout {
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property string valueIndicatorStyle: widgetData.indicatorStyle !== undefined ? widgetData.indicatorStyle : widgetMetadata.indicatorStyle
|
||||
property bool valueShowCapsLock: widgetData.showCapsLock !== undefined ? widgetData.showCapsLock : widgetMetadata.showCapsLock
|
||||
property bool valueShowNumLock: widgetData.showNumLock !== undefined ? widgetData.showNumLock : widgetMetadata.showNumLock
|
||||
property bool valueShowScrollLock: widgetData.showScrollLock !== undefined ? widgetData.showScrollLock : widgetMetadata.showScrollLock
|
||||
|
||||
property string capsIcon: widgetData.capsLockIcon !== undefined ? widgetData.capsLockIcon : widgetMetadata.capsLockIcon
|
||||
property string numIcon: widgetData.numLockIcon !== undefined ? widgetData.numLockIcon : widgetMetadata.numLockIcon
|
||||
property string scrollIcon: widgetData.scrollLockIcon !== undefined ? widgetData.scrollLockIcon : widgetMetadata.scrollLockIcon
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.indicatorStyle = valueIndicatorStyle
|
||||
settings.showCapsLock = valueShowCapsLock
|
||||
settings.showNumLock = valueShowNumLock
|
||||
settings.showScrollLock = valueShowScrollLock
|
||||
settings.capsLockIcon = capsIcon
|
||||
settings.numLockIcon = numIcon
|
||||
settings.scrollLockIcon = scrollIcon
|
||||
return settings
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.widget-settings.lock-keys.indicator-style.label")
|
||||
description: I18n.tr("bar.widget-settings.lock-keys.indicator-style.description")
|
||||
model: [{
|
||||
"key": "large",
|
||||
"name": I18n.tr("bar.widget-settings.lock-keys.indicator-style.large")
|
||||
}, {
|
||||
"key": "small",
|
||||
"name": I18n.tr("bar.widget-settings.lock-keys.indicator-style.small")
|
||||
}, {
|
||||
"key": "square",
|
||||
"name": I18n.tr("bar.widget-settings.lock-keys.indicator-style.square")
|
||||
}, {
|
||||
"key": "square-round",
|
||||
"name": I18n.tr("bar.widget-settings.lock-keys.indicator-style.square-round")
|
||||
}, {
|
||||
"key": "circle",
|
||||
"name": I18n.tr("bar.widget-settings.lock-keys.indicator-style.circle")
|
||||
}, {
|
||||
"key": "circle-dash",
|
||||
"name": I18n.tr("bar.widget-settings.lock-keys.indicator-style.circle-dash")
|
||||
}, {
|
||||
"key": "circle-dot",
|
||||
"name": I18n.tr("bar.widget-settings.lock-keys.indicator-style.circle-dot")
|
||||
}, {
|
||||
"key": "hex",
|
||||
"name": I18n.tr("bar.widget-settings.lock-keys.indicator-style.hex")
|
||||
}]
|
||||
currentKey: valueIndicatorStyle
|
||||
onSelected: key => valueIndicatorStyle = key
|
||||
RowLayout {
|
||||
spacing: Style.marginM
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("bar.widget-settings.lock-keys.show-caps-lock.label")
|
||||
description: I18n.tr("bar.widget-settings.lock-keys.show-caps-lock.description")
|
||||
checked: valueShowCapsLock
|
||||
onToggled: checked => valueShowCapsLock = checked
|
||||
}
|
||||
|
||||
NIcon {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
icon: capsIcon
|
||||
pointSize: Style.fontSizeXL
|
||||
visible: capsIcon !== ""
|
||||
}
|
||||
|
||||
NButton {
|
||||
text: I18n.tr("bar.widget-settings.custom-button.browse")
|
||||
onClicked: capsPicker.open()
|
||||
enabled: valueShowCapsLock
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("bar.widget-settings.lock-keys.show-caps-lock.label")
|
||||
description: I18n.tr("bar.widget-settings.lock-keys.show-caps-lock.description")
|
||||
checked: valueShowCapsLock
|
||||
onToggled: checked => valueShowCapsLock = checked
|
||||
NIconPicker {
|
||||
id: capsPicker
|
||||
initialIcon: capsIcon
|
||||
query: "letter-c"
|
||||
onIconSelected: function (iconName) {
|
||||
capsIcon = iconName
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("bar.widget-settings.lock-keys.show-num-lock.label")
|
||||
description: I18n.tr("bar.widget-settings.lock-keys.show-num-lock.description")
|
||||
checked: valueShowNumLock
|
||||
onToggled: checked => valueShowNumLock = checked
|
||||
RowLayout {
|
||||
spacing: Style.marginM
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("bar.widget-settings.lock-keys.show-num-lock.label")
|
||||
description: I18n.tr("bar.widget-settings.lock-keys.show-num-lock.description")
|
||||
checked: valueShowNumLock
|
||||
onToggled: checked => valueShowNumLock = checked
|
||||
}
|
||||
|
||||
NIcon {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
icon: numIcon
|
||||
pointSize: Style.fontSizeXL
|
||||
visible: numIcon !== ""
|
||||
}
|
||||
|
||||
NButton {
|
||||
text: I18n.tr("bar.widget-settings.custom-button.browse")
|
||||
onClicked: numPicker.open()
|
||||
enabled: valueShowNumLock
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("bar.widget-settings.lock-keys.show-scroll-lock.label")
|
||||
description: I18n.tr("bar.widget-settings.lock-keys.show-scroll-lock.description")
|
||||
checked: valueShowScrollLock
|
||||
onToggled: checked => valueShowScrollLock = checked
|
||||
NIconPicker {
|
||||
id: numPicker
|
||||
initialIcon: numIcon
|
||||
query: "letter-n"
|
||||
onIconSelected: function (iconName) {
|
||||
numIcon = iconName
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: Style.marginM
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("bar.widget-settings.lock-keys.show-scroll-lock.label")
|
||||
description: I18n.tr("bar.widget-settings.lock-keys.show-scroll-lock.description")
|
||||
checked: valueShowScrollLock
|
||||
onToggled: checked => valueShowScrollLock = checked
|
||||
}
|
||||
|
||||
NIcon {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
icon: scrollIcon
|
||||
pointSize: Style.fontSizeXL
|
||||
visible: scrollIcon !== ""
|
||||
}
|
||||
|
||||
NButton {
|
||||
text: I18n.tr("bar.widget-settings.custom-button.browse")
|
||||
onClicked: scrollPicker.open()
|
||||
enabled: valueShowScrollLock
|
||||
}
|
||||
}
|
||||
|
||||
NIconPicker {
|
||||
id: scrollPicker
|
||||
initialIcon: scrollIcon
|
||||
query: "letter-s"
|
||||
onIconSelected: function (iconName) {
|
||||
scrollIcon = iconName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,10 +101,12 @@ Singleton {
|
||||
},
|
||||
"LockKeys": {
|
||||
"allowUserSettings": true,
|
||||
"indicatorStyle": "large",
|
||||
"showCapsLock": true,
|
||||
"showNumLock": true,
|
||||
"showScrollLock": true
|
||||
"showScrollLock": true,
|
||||
"capsLockIcon": "letter-c",
|
||||
"numLockIcon": "letter-n",
|
||||
"scrollLockIcon": "letter-s",
|
||||
},
|
||||
"MediaMini": {
|
||||
"allowUserSettings": true,
|
||||
|
||||
Reference in New Issue
Block a user