updated config
This commit is contained in:
@@ -5,347 +5,397 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
id: root
|
||||
|
||||
readonly property var iconNames: ["arrow", "arrow-bar", "arrow-big", "arrow-narrow", "caret", "chevron", "chevron-compact", "fold"]
|
||||
property var pluginApi: null
|
||||
|
||||
property var pluginApi: null
|
||||
property var cfg: pluginApi?.pluginSettings || ({})
|
||||
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
|
||||
|
||||
property var cfg: pluginApi?.pluginSettings || ({})
|
||||
property var defaults: pluginApi?.manifest?.metadata?.defaultSettings || ({})
|
||||
// ── Options ──
|
||||
|
||||
property string editArrowType: cfg.arrowType ?? defaults.arrowType
|
||||
property int editByteThresholdActive: cfg.byteThresholdActive ?? defaults.byteThresholdActive
|
||||
property real editFontSizeModifier: cfg.fontSizeModifier ?? defaults.fontSizeModifier
|
||||
property bool editHorizontalLayout: cfg.horizontalLayout ?? defaults.horizontalLayout ?? false
|
||||
property real editIconSizeModifier: cfg.iconSizeModifier ?? defaults.iconSizeModifier
|
||||
property bool editShowNumbers: cfg.showNumbers ?? defaults.showNumbers
|
||||
property real editSpacingInbetween: cfg.spacingInbetween ?? defaults.spacingInbetween
|
||||
property real editContentMargin: cfg.contentMargin ?? defaults.contentMargin ?? Style.marginS
|
||||
readonly property var slotOptions: [
|
||||
{
|
||||
key: "txIcon",
|
||||
name: pluginApi?.tr("settings.slot.txIcon")
|
||||
},
|
||||
{
|
||||
key: "rxIcon",
|
||||
name: pluginApi?.tr("settings.slot.rxIcon")
|
||||
},
|
||||
{
|
||||
key: "txSpeed",
|
||||
name: pluginApi?.tr("settings.slot.txSpeed")
|
||||
},
|
||||
{
|
||||
key: "rxSpeed",
|
||||
name: pluginApi?.tr("settings.slot.rxSpeed")
|
||||
},
|
||||
{
|
||||
key: "none",
|
||||
name: pluginApi?.tr("settings.slot.none")
|
||||
}
|
||||
]
|
||||
|
||||
property bool editUseCustomFont: cfg.useCustomFont ?? defaults.useCustomFont ?? false
|
||||
property string editCustomFontFamily: cfg.customFontFamily ?? defaults.customFontFamily ?? ""
|
||||
property bool editCustomFontBold: cfg.customFontBold ?? defaults.customFontBold ?? false
|
||||
property bool editCustomFontItalic: cfg.customFontItalic ?? defaults.customFontItalic ?? false
|
||||
readonly property var layoutOptions: [
|
||||
{
|
||||
key: "horizontal",
|
||||
name: pluginApi?.tr("settings.layout.horizontal")
|
||||
},
|
||||
{
|
||||
key: "vertical",
|
||||
name: pluginApi?.tr("settings.layout.vertical")
|
||||
}
|
||||
]
|
||||
|
||||
property bool editUseCustomColors: cfg.useCustomColors ?? defaults.useCustomColors ?? false
|
||||
property color editColorBackground: editUseCustomColors && cfg.colorBackground || Style.capsuleColor
|
||||
property color editColorFont: editUseCustomColors && cfg.colorFont || Color.mOnSurface
|
||||
property color editColorRx: editUseCustomColors && cfg.colorRx || Color.mPrimary
|
||||
property color editColorSilent: editUseCustomColors && cfg.colorSilent || Color.mSurfaceVariant
|
||||
property color editColorText: editUseCustomColors && cfg.colorText || Qt.alpha(Color.mOnSurfaceVariant, 0.3)
|
||||
property color editColorTx: editUseCustomColors && cfg.colorTx || Color.mSecondary
|
||||
readonly property var iconNames: ["arrow", "arrow-bar", "arrow-big", "arrow-narrow", "caret", "chevron", "chevron-compact", "fold"]
|
||||
|
||||
property string barPosition: Settings.data.bar.position || "top"
|
||||
property string barDensity: Settings.data.bar.density || "compact"
|
||||
property bool barIsSpacious: barDensity !== "mini"
|
||||
property bool barIsVertical: barPosition === "left" || barPosition === "right"
|
||||
// ── Edit state ──
|
||||
|
||||
function toIntOr(defaultValue, text) {
|
||||
const v = parseInt(String(text).trim(), 10);
|
||||
return isNaN(v) ? defaultValue : v;
|
||||
property string editLayout: cfg.layout ?? defaults.layout
|
||||
property var editSlots: cfg.slots ?? defaults.slots
|
||||
property string editIconType: cfg.iconType ?? defaults.iconType
|
||||
property int editByteThresholdActive: cfg.byteThresholdActive ?? defaults.byteThresholdActive
|
||||
|
||||
property real editFontSizeModifier: cfg.fontSizeModifier ?? defaults.fontSizeModifier
|
||||
property real editIconSizeModifier: cfg.iconSizeModifier ?? defaults.iconSizeModifier
|
||||
property real editPaddingLeft: cfg.paddingLeft ?? defaults.PaddingLeft
|
||||
property real editPaddingRight: cfg.paddingRight ?? defaults.paddingRight
|
||||
property real editColumnSpacing: cfg.columnSpacing ?? defaults.columnSpacing
|
||||
property real editRowSpacing: cfg.rowSpacing ?? defaults.rowSpacing
|
||||
|
||||
property bool editUseCustomFont: cfg.useCustomFont ?? defaults.useCustomFonts
|
||||
property string editCustomFontFamily: cfg.customFontFamily ?? defaults.customFontFamily
|
||||
property bool editCustomFontBold: cfg.customFontBold ?? defaults.customFontBold
|
||||
property bool editCustomFontItalic: cfg.customFontItalic ?? defaults.customFontItalic
|
||||
|
||||
property bool editUseCustomColors: cfg.useCustomColors ?? defaults.useCustomColors
|
||||
property color editColorTx: editUseCustomColors && cfg.colorTx || Color.mSecondary
|
||||
property color editColorRx: editUseCustomColors && cfg.colorRx || Color.mPrimary
|
||||
property color editColorSilent: editUseCustomColors && cfg.colorSilent || Color.mSurfaceVariant
|
||||
property color editColorText: editUseCustomColors && cfg.colorText || Color.mOnSurfaceVariant
|
||||
|
||||
// ── Helpers ──
|
||||
|
||||
readonly property bool isVerticalLayout: editLayout === "vertical"
|
||||
|
||||
function slotLabel(idx) {
|
||||
if (root.isVerticalLayout) {
|
||||
return ["Top Left", "Top Right", "Bottom Left", "Bottom Right"][idx];
|
||||
}
|
||||
return ["Left", "Center Left", "Center Right", "Right"][idx];
|
||||
}
|
||||
|
||||
function updateSlot(index, value) {
|
||||
let copy = root.editSlots.slice();
|
||||
copy[index] = value;
|
||||
root.editSlots = copy;
|
||||
}
|
||||
|
||||
function toIntOr(defaultValue, text) {
|
||||
const v = parseInt(String(text).trim(), 10);
|
||||
return isNaN(v) ? defaultValue : v;
|
||||
}
|
||||
|
||||
// ── Save ──
|
||||
|
||||
function saveSettings() {
|
||||
if (!pluginApi || !pluginApi.pluginSettings) {
|
||||
Logger.e("NetworkIndicator", "Cannot save: pluginApi or pluginSettings is null");
|
||||
return;
|
||||
}
|
||||
|
||||
function saveSettings() {
|
||||
if (!pluginApi || !pluginApi.pluginSettings) {
|
||||
Logger.e("NetworkIndicator", "Cannot save: pluginApi or pluginSettings is null");
|
||||
return;
|
||||
}
|
||||
const s = pluginApi.pluginSettings;
|
||||
|
||||
pluginApi.pluginSettings.arrowType = root.editArrowType;
|
||||
pluginApi.pluginSettings.byteThresholdActive = root.editByteThresholdActive;
|
||||
pluginApi.pluginSettings.showNumbers = root.editShowNumbers;
|
||||
pluginApi.pluginSettings.horizontalLayout = root.editHorizontalLayout;
|
||||
pluginApi.pluginSettings.fontSizeModifier = root.editFontSizeModifier;
|
||||
pluginApi.pluginSettings.iconSizeModifier = root.editIconSizeModifier;
|
||||
pluginApi.pluginSettings.spacingInbetween = root.editSpacingInbetween;
|
||||
pluginApi.pluginSettings.contentMargin = root.editContentMargin;
|
||||
s.layout = root.editLayout;
|
||||
s.slots = root.editSlots;
|
||||
s.iconType = root.editIconType;
|
||||
s.byteThresholdActive = root.editByteThresholdActive;
|
||||
|
||||
pluginApi.pluginSettings.useCustomFont = root.editUseCustomFont;
|
||||
pluginApi.pluginSettings.customFontFamily = root.editCustomFontFamily;
|
||||
pluginApi.pluginSettings.customFontBold = root.editCustomFontBold;
|
||||
pluginApi.pluginSettings.customFontItalic = root.editCustomFontItalic;
|
||||
s.fontSizeModifier = root.editFontSizeModifier;
|
||||
s.iconSizeModifier = root.editIconSizeModifier;
|
||||
|
||||
pluginApi.pluginSettings.useCustomColors = root.editUseCustomColors;
|
||||
if (root.editUseCustomColors) {
|
||||
pluginApi.pluginSettings.colorSilent = root.editColorSilent.toString();
|
||||
pluginApi.pluginSettings.colorTx = root.editColorTx.toString();
|
||||
pluginApi.pluginSettings.colorRx = root.editColorRx.toString();
|
||||
pluginApi.pluginSettings.colorText = root.editColorText.toString();
|
||||
pluginApi.pluginSettings.colorFont = root.editColorFont.toString();
|
||||
pluginApi.pluginSettings.colorBackground = root.editColorBackground.toString();
|
||||
}
|
||||
s.paddingLeft = root.editPaddingLeft;
|
||||
s.paddingRight = root.editPaddingRight;
|
||||
s.columnSpacing = root.editColumnSpacing;
|
||||
s.rowSpacing = root.editRowSpacing;
|
||||
|
||||
pluginApi.saveSettings();
|
||||
Logger.i("NetworkIndicator", "Settings saved");
|
||||
s.useCustomFont = root.editUseCustomFont;
|
||||
s.customFontFamily = root.editCustomFontFamily;
|
||||
s.customFontBold = root.editCustomFontBold;
|
||||
s.customFontItalic = root.editCustomFontItalic;
|
||||
|
||||
s.useCustomColors = root.editUseCustomColors;
|
||||
if (root.editUseCustomColors) {
|
||||
s.colorTx = root.editColorTx.toString();
|
||||
s.colorRx = root.editColorRx.toString();
|
||||
s.colorSilent = root.editColorSilent.toString();
|
||||
s.colorText = root.editColorText.toString();
|
||||
}
|
||||
|
||||
Layout.rightMargin: Style.marginL
|
||||
spacing: Style.marginL
|
||||
pluginApi.saveSettings();
|
||||
Logger.i("NetworkIndicator", "Settings saved");
|
||||
}
|
||||
|
||||
// ── Icon ──
|
||||
// ── UI ──
|
||||
|
||||
Layout.rightMargin: Style.marginL
|
||||
spacing: Style.marginL
|
||||
|
||||
// ── Layout ──
|
||||
|
||||
NComboBox {
|
||||
Layout.fillWidth: true
|
||||
label: pluginApi?.tr("settings.layout.label")
|
||||
description: pluginApi?.tr("settings.layout.desc")
|
||||
currentKey: root.editLayout
|
||||
model: root.layoutOptions
|
||||
onSelected: key => root.editLayout = key
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// ── Slot assignment ──
|
||||
|
||||
NLabel {
|
||||
label: pluginApi?.tr("settings.slots.label")
|
||||
description: pluginApi?.tr("settings.slots.desc")
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: 4
|
||||
|
||||
NComboBox {
|
||||
currentKey: root.editArrowType
|
||||
description: root.pluginApi?.tr("settings.iconType.desc")
|
||||
label: root.pluginApi?.tr("settings.iconType.label")
|
||||
model: root.iconNames.map(n => ({
|
||||
key: n,
|
||||
name: n
|
||||
}))
|
||||
Layout.fillWidth: true
|
||||
label: root.slotLabel(index)
|
||||
currentKey: root.editSlots[index] ?? "none"
|
||||
model: root.slotOptions
|
||||
onSelected: key => root.updateSlot(index, key)
|
||||
}
|
||||
}
|
||||
|
||||
onSelected: key => root.editArrowType = key
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// ── Icon style ──
|
||||
|
||||
NComboBox {
|
||||
Layout.fillWidth: true
|
||||
label: pluginApi?.tr("settings.iconType.label")
|
||||
description: pluginApi?.tr("settings.iconType.desc")
|
||||
currentKey: root.editIconType
|
||||
model: root.iconNames.map(n => ({
|
||||
key: n,
|
||||
name: n
|
||||
}))
|
||||
onSelected: key => root.editIconType = key
|
||||
}
|
||||
|
||||
// ── Activity threshold ──
|
||||
|
||||
NTextInput {
|
||||
label: pluginApi?.tr("settings.byteThresholdActive.label")
|
||||
description: pluginApi?.tr("settings.byteThresholdActive.desc")
|
||||
placeholderText: root.editByteThresholdActive + " bytes"
|
||||
text: String(root.editByteThresholdActive)
|
||||
onTextChanged: root.editByteThresholdActive = root.toIntOr(0, text)
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// ── Size modifiers ──
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginXXS
|
||||
|
||||
NLabel {
|
||||
label: pluginApi?.tr("settings.fontSizeModifier.label")
|
||||
description: pluginApi?.tr("settings.fontSizeModifier.desc")
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
NValueSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0.5
|
||||
to: 1.5
|
||||
stepSize: 0.05
|
||||
text: root.editFontSizeModifier.toFixed(2)
|
||||
value: root.editFontSizeModifier
|
||||
onMoved: value => root.editFontSizeModifier = value
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginXXS
|
||||
|
||||
NLabel {
|
||||
label: pluginApi?.tr("settings.iconSizeModifier.label")
|
||||
description: pluginApi?.tr("settings.iconSizeModifier.desc")
|
||||
}
|
||||
|
||||
// ── General ──
|
||||
NValueSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0.5
|
||||
to: 1.5
|
||||
stepSize: 0.05
|
||||
text: root.editIconSizeModifier.toFixed(2)
|
||||
value: root.editIconSizeModifier
|
||||
onMoved: value => root.editIconSizeModifier = value
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
checked: root.editShowNumbers
|
||||
defaultValue: defaults.showNumbers ?? true
|
||||
description: root.pluginApi?.tr("settings.showNumbers.desc")
|
||||
label: root.pluginApi?.tr("settings.showNumbers.label")
|
||||
visible: root.barIsSpacious && !root.barIsVertical
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
onToggled: c => root.editShowNumbers = c
|
||||
// ── Content padding ──
|
||||
|
||||
NTextInput {
|
||||
label: pluginApi?.tr("settings.rowSpacing.label")
|
||||
description: pluginApi?.tr("settings.rowSpacing.desc")
|
||||
placeholderText: root.editRowSpacing + " px"
|
||||
text: String(root.editRowSpacing)
|
||||
onTextChanged: root.editRowSpacing = root.toIntOr(0, text)
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
label: pluginApi?.tr("settings.columnSpacing.label")
|
||||
description: pluginApi?.tr("settings.columnSpacing.desc")
|
||||
placeholderText: root.editColumnSpacing + " px"
|
||||
text: String(root.editColumnSpacing)
|
||||
onTextChanged: root.editColumnSpacing = root.toIntOr(0, text)
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
label: pluginApi?.tr("settings.paddingLeft.label")
|
||||
description: pluginApi?.tr("settings.paddingLeft.desc")
|
||||
placeholderText: root.editPaddingLeft + " px"
|
||||
text: String(root.editPaddingLeft)
|
||||
onTextChanged: root.editPaddingLeft = root.toIntOr(0, text)
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
label: pluginApi?.tr("settings.paddingRight.label")
|
||||
description: pluginApi?.tr("settings.paddingRight.desc")
|
||||
placeholderText: root.editPaddingRight + " px"
|
||||
text: String(root.editPaddingRight)
|
||||
onTextChanged: root.editPaddingRight = root.toIntOr(0, text)
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// ── Custom Font ──
|
||||
|
||||
NToggle {
|
||||
checked: root.editUseCustomFont
|
||||
defaultValue: defaults.useCustomFont ?? false
|
||||
description: pluginApi?.tr("settings.useCustomFont.desc")
|
||||
label: pluginApi?.tr("settings.useCustomFont.label")
|
||||
onToggled: c => root.editUseCustomFont = c
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
visible: root.editUseCustomFont
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginL
|
||||
|
||||
NSearchableComboBox {
|
||||
label: pluginApi?.tr("settings.customFontFamily.label")
|
||||
description: pluginApi?.tr("settings.customFontFamily.desc")
|
||||
model: FontService.availableFonts
|
||||
currentKey: root.editCustomFontFamily || Qt.application.font.family
|
||||
placeholder: pluginApi?.tr("settings.customFontFamily.placeholder")
|
||||
searchPlaceholder: pluginApi?.tr("settings.customFontFamily.searchPlaceholder")
|
||||
popupHeight: 420
|
||||
onSelected: key => {
|
||||
root.editCustomFontFamily = (key === Qt.application.font.family) ? "" : key;
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
checked: root.editHorizontalLayout
|
||||
defaultValue: defaults.horizontalLayout ?? false
|
||||
description: root.pluginApi?.tr("settings.horizontalLayout.desc")
|
||||
label: root.pluginApi?.tr("settings.horizontalLayout.label")
|
||||
visible: root.barIsSpacious && !root.barIsVertical
|
||||
|
||||
onToggled: c => root.editHorizontalLayout = c
|
||||
checked: root.editCustomFontBold
|
||||
defaultValue: defaults.customFontBold ?? false
|
||||
description: pluginApi?.tr("settings.customFontBold.desc")
|
||||
label: pluginApi?.tr("settings.customFontBold.label")
|
||||
onToggled: c => root.editCustomFontBold = c
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// ── Layout ──
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginXXS
|
||||
|
||||
NLabel {
|
||||
description: root.pluginApi?.tr("settings.contentMargin.desc")
|
||||
label: root.pluginApi?.tr("settings.contentMargin.label")
|
||||
}
|
||||
|
||||
NValueSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0
|
||||
stepSize: 1
|
||||
text: root.editContentMargin + "px"
|
||||
to: 20
|
||||
value: root.editContentMargin
|
||||
|
||||
onMoved: value => root.editContentMargin = value
|
||||
}
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
label: pluginApi?.tr("settings.byteThresholdActive.label")
|
||||
description: pluginApi?.tr("settings.byteThresholdActive.desc")
|
||||
placeholderText: root.editByteThresholdActive + " bytes"
|
||||
text: String(root.editByteThresholdActive)
|
||||
onTextChanged: root.editByteThresholdActive = root.toIntOr(0, text)
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginXXS
|
||||
|
||||
NLabel {
|
||||
description: root.pluginApi?.tr("settings.spacingInbetween.desc")
|
||||
label: root.pluginApi?.tr("settings.spacingInbetween.label")
|
||||
}
|
||||
|
||||
NValueSlider {
|
||||
Layout.fillWidth: true
|
||||
from: -5
|
||||
stepSize: 1
|
||||
text: root.editSpacingInbetween.toFixed(0)
|
||||
to: 5
|
||||
value: root.editSpacingInbetween
|
||||
|
||||
onMoved: value => root.editSpacingInbetween = value
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginXXS
|
||||
|
||||
NLabel {
|
||||
description: root.pluginApi?.tr("settings.fontSizeModifier.desc")
|
||||
label: root.pluginApi?.tr("settings.fontSizeModifier.label")
|
||||
}
|
||||
|
||||
NValueSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0.5
|
||||
stepSize: 0.05
|
||||
text: root.editFontSizeModifier.toFixed(2)
|
||||
to: 1.5
|
||||
value: root.editFontSizeModifier
|
||||
|
||||
onMoved: value => root.editFontSizeModifier = value
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginXXS
|
||||
|
||||
NLabel {
|
||||
description: root.pluginApi?.tr("settings.iconSizeModifier.desc")
|
||||
label: root.pluginApi?.tr("settings.iconSizeModifier.label")
|
||||
}
|
||||
|
||||
NValueSlider {
|
||||
Layout.fillWidth: true
|
||||
from: 0.5
|
||||
stepSize: 0.05
|
||||
text: root.editIconSizeModifier.toFixed(2)
|
||||
to: 1.5
|
||||
value: root.editIconSizeModifier
|
||||
|
||||
onMoved: value => root.editIconSizeModifier = value
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
// ── Font ──
|
||||
|
||||
NToggle {
|
||||
checked: root.editUseCustomFont
|
||||
defaultValue: defaults.useCustomFont ?? false
|
||||
description: root.pluginApi?.tr("settings.useCustomFont.desc")
|
||||
label: root.pluginApi?.tr("settings.useCustomFont.label")
|
||||
checked: root.editCustomFontItalic
|
||||
defaultValue: defaults.customFontItalic ?? false
|
||||
description: pluginApi?.tr("settings.customFontItalic.desc")
|
||||
label: pluginApi?.tr("settings.customFontItalic.label")
|
||||
onToggled: c => root.editCustomFontItalic = c
|
||||
}
|
||||
}
|
||||
|
||||
onToggled: c => root.editUseCustomFont = c
|
||||
// ── Custom Colors ──
|
||||
|
||||
NToggle {
|
||||
checked: root.editUseCustomColors
|
||||
defaultValue: defaults.useCustomColors ?? false
|
||||
description: pluginApi?.tr("settings.useCustomColors.desc")
|
||||
label: pluginApi?.tr("settings.useCustomColors.label")
|
||||
onToggled: c => root.editUseCustomColors = c
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
visible: root.editUseCustomColors
|
||||
|
||||
RowLayout {
|
||||
NLabel {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
label: pluginApi?.tr("settings.colorTx.label")
|
||||
description: pluginApi?.tr("settings.colorTx.desc")
|
||||
}
|
||||
NColorPicker {
|
||||
selectedColor: root.editColorTx
|
||||
onColorSelected: color => root.editColorTx = color
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
visible: root.editUseCustomFont
|
||||
Layout.fillWidth: true
|
||||
spacing: Style.marginL
|
||||
|
||||
NSearchableComboBox {
|
||||
label: root.pluginApi?.tr("settings.customFontFamily.label")
|
||||
description: root.pluginApi?.tr("settings.customFontFamily.desc")
|
||||
model: FontService.availableFonts
|
||||
currentKey: root.editCustomFontFamily || Qt.application.font.family
|
||||
placeholder: root.pluginApi?.tr("settings.customFontFamily.placeholder")
|
||||
searchPlaceholder: root.pluginApi?.tr("settings.customFontFamily.searchPlaceholder")
|
||||
popupHeight: 420
|
||||
|
||||
onSelected: key => {
|
||||
root.editCustomFontFamily = (key === Qt.application.font.family) ? "" : key;
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
checked: root.editCustomFontBold
|
||||
defaultValue: defaults.customFontBold ?? false
|
||||
description: root.pluginApi?.tr("settings.customFontBold.desc")
|
||||
label: root.pluginApi?.tr("settings.customFontBold.label")
|
||||
|
||||
onToggled: c => root.editCustomFontBold = c
|
||||
}
|
||||
|
||||
NToggle {
|
||||
checked: root.editCustomFontItalic
|
||||
defaultValue: defaults.customFontItalic ?? false
|
||||
description: root.pluginApi?.tr("settings.customFontItalic.desc")
|
||||
label: root.pluginApi?.tr("settings.customFontItalic.label")
|
||||
|
||||
onToggled: c => root.editCustomFontItalic = c
|
||||
}
|
||||
RowLayout {
|
||||
NLabel {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
label: pluginApi?.tr("settings.colorRx.label")
|
||||
description: pluginApi?.tr("settings.colorRx.desc")
|
||||
}
|
||||
NColorPicker {
|
||||
selectedColor: root.editColorRx
|
||||
onColorSelected: color => root.editColorRx = color
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
RowLayout {
|
||||
NLabel {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
label: pluginApi?.tr("settings.colorSilent.label")
|
||||
description: pluginApi?.tr("settings.colorSilent.desc")
|
||||
}
|
||||
NColorPicker {
|
||||
selectedColor: root.editColorSilent
|
||||
onColorSelected: color => root.editColorSilent = color
|
||||
}
|
||||
}
|
||||
|
||||
// ── Colors ──
|
||||
|
||||
NToggle {
|
||||
checked: root.editUseCustomColors
|
||||
defaultValue: defaults.useCustomColors ?? false
|
||||
description: root.pluginApi?.tr("settings.useCustomColors.desc")
|
||||
label: root.pluginApi?.tr("settings.useCustomColors.label")
|
||||
|
||||
onToggled: c => root.editUseCustomColors = c
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
visible: root.editUseCustomColors
|
||||
|
||||
RowLayout {
|
||||
NLabel {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
description: root.pluginApi?.tr("settings.colorTx.desc")
|
||||
label: root.pluginApi?.tr("settings.colorTx.label")
|
||||
}
|
||||
|
||||
NColorPicker {
|
||||
selectedColor: root.editColorTx
|
||||
|
||||
onColorSelected: color => root.editColorTx = color
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
NLabel {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
description: root.pluginApi?.tr("settings.colorRx.desc")
|
||||
label: root.pluginApi?.tr("settings.colorRx.label")
|
||||
}
|
||||
|
||||
NColorPicker {
|
||||
selectedColor: root.editColorRx
|
||||
|
||||
onColorSelected: color => root.editColorRx = color
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
NLabel {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
description: root.pluginApi?.tr("settings.colorSilent.desc")
|
||||
label: root.pluginApi?.tr("settings.colorSilent.label")
|
||||
}
|
||||
|
||||
NColorPicker {
|
||||
selectedColor: root.editColorSilent
|
||||
|
||||
onColorSelected: color => root.editColorSilent = color
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
NLabel {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
description: root.pluginApi?.tr("settings.colorText.desc")
|
||||
label: root.pluginApi?.tr("settings.colorText.label")
|
||||
}
|
||||
|
||||
NColorPicker {
|
||||
selectedColor: root.editColorText
|
||||
|
||||
onColorSelected: color => root.editColorText = color
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
NLabel {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
label: pluginApi?.tr("settings.colorText.label")
|
||||
description: pluginApi?.tr("settings.colorText.desc")
|
||||
}
|
||||
NColorPicker {
|
||||
selectedColor: root.editColorText
|
||||
onColorSelected: color => root.editColorText = color
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user