Bar Widget Settings: One file per Widget settings, refactor - wip
This commit is contained in:
parent
c01167c9da
commit
45af873a6f
27 changed files with 707 additions and 765 deletions
|
|
@ -39,23 +39,6 @@ RowLayout {
|
|||
return CompositorService.focusedWindowTitle !== "(No active window)" ? CompositorService.focusedWindowTitle : ""
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].showIcon === undefined
|
||||
&& Settings.data.bar.showActiveWindowIcon !== undefined) {
|
||||
widgets[sectionWidgetIndex].showIcon = Settings.data.bar.showActiveWindowIcon
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getAppIcon() {
|
||||
// Try CompositorService first
|
||||
const focusedWindow = CompositorService.getFocusedWindow()
|
||||
|
|
|
|||
|
|
@ -11,11 +11,41 @@ Item {
|
|||
|
||||
property ShellScreen screen
|
||||
property real scaling: 1.0
|
||||
|
||||
// Widget properties passed from Bar.qml for per-instance settings
|
||||
property string barSection: ""
|
||||
property int sectionWidgetIndex: 0
|
||||
property int sectionWidgetIndex: -1
|
||||
property int sectionWidgetsCount: 0
|
||||
|
||||
// Track if we've already notified to avoid spam
|
||||
// Resolve per-instance widget settings from Settings.data
|
||||
property var widgetSettings: {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
return widgets[sectionWidgetIndex]
|
||||
}
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
// Resolve settings: try user settings or defaults from BarWidgetRegistry
|
||||
readonly property bool alwaysShowPercentage: widgetSettings.alwaysShowPercentage
|
||||
!== undefined ? widgetSettings.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Battery"].alwaysShowPercentage
|
||||
readonly property real warningThreshold: widgetSettings.warningThreshold
|
||||
!== undefined ? widgetSettings.warningThreshold : BarWidgetRegistry.widgetMetadata["Battery"].warningThreshold
|
||||
|
||||
// Test mode
|
||||
readonly property bool testMode: true
|
||||
readonly property int testPercent: 50
|
||||
readonly property bool testCharging: true
|
||||
|
||||
// Main properties
|
||||
readonly property var battery: UPower.displayDevice
|
||||
readonly property bool isReady: testMode ? true : (battery && battery.ready && battery.isLaptopBattery
|
||||
&& battery.isPresent)
|
||||
readonly property real percent: testMode ? testPercent : (isReady ? (battery.percentage * 100) : 0)
|
||||
readonly property bool charging: testMode ? testCharging : (isReady ? battery.state === UPowerDeviceState.Charging : false)
|
||||
property bool hasNotifiedLowBattery: false
|
||||
|
||||
implicitWidth: pill.width
|
||||
|
|
@ -23,15 +53,14 @@ Item {
|
|||
|
||||
// Helper to evaluate and possibly notify
|
||||
function maybeNotify(percent, charging) {
|
||||
const p = Math.round(percent)
|
||||
// Only notify exactly at 15%, not at 0% or any other percentage
|
||||
if (!charging && p === 15 && !root.hasNotifiedLowBattery) {
|
||||
// Only notify once we are a below threshold
|
||||
if (!charging && !root.hasNotifiedLowBattery && percent <= warningThreshold) {
|
||||
root.hasNotifiedLowBattery = true
|
||||
// Maybe go with toast ?
|
||||
Quickshell.execDetached(
|
||||
["notify-send", "-u", "critical", "-i", "battery-caution", "Low Battery", `Battery is at ${p}%. Please connect charger.`])
|
||||
root.hasNotifiedLowBattery = true
|
||||
}
|
||||
// Reset when charging starts or when battery recovers above 20%
|
||||
if (charging || p > 20) {
|
||||
} else if (root.hasNotifiedLowBattery && (charging || percent > warningThreshold + 5)) {
|
||||
// Reset when charging starts or when battery recovers 5% above threshold
|
||||
root.hasNotifiedLowBattery = false
|
||||
}
|
||||
}
|
||||
|
|
@ -40,19 +69,10 @@ Item {
|
|||
Connections {
|
||||
target: UPower.displayDevice
|
||||
function onPercentageChanged() {
|
||||
let battery = UPower.displayDevice
|
||||
let isReady = battery && battery.ready && battery.isLaptopBattery && battery.isPresent
|
||||
let percent = isReady ? (battery.percentage * 100) : 0
|
||||
let charging = isReady ? battery.state === UPowerDeviceState.Charging : false
|
||||
|
||||
root.maybeNotify(percent, charging)
|
||||
}
|
||||
|
||||
function onStateChanged() {
|
||||
let battery = UPower.displayDevice
|
||||
let isReady = battery && battery.ready && battery.isLaptopBattery && battery.isPresent
|
||||
let charging = isReady ? battery.state === UPowerDeviceState.Charging : false
|
||||
|
||||
// Reset notification flag when charging starts
|
||||
if (charging) {
|
||||
root.hasNotifiedLowBattery = false
|
||||
|
|
@ -63,15 +83,6 @@ Item {
|
|||
NPill {
|
||||
id: pill
|
||||
|
||||
// Test mode
|
||||
property bool testMode: false
|
||||
property int testPercent: 50
|
||||
property bool testCharging: true
|
||||
property var battery: UPower.displayDevice
|
||||
property bool isReady: testMode ? true : (battery && battery.ready && battery.isLaptopBattery && battery.isPresent)
|
||||
property real percent: testMode ? testPercent : (isReady ? (battery.percentage * 100) : 0)
|
||||
property bool charging: testMode ? testCharging : (isReady ? battery.state === UPowerDeviceState.Charging : false)
|
||||
|
||||
rightOpen: BarWidgetRegistry.getNPillDirection(root)
|
||||
icon: testMode ? BatteryService.getIcon(testPercent, testCharging, true) : BatteryService.getIcon(percent,
|
||||
charging, isReady)
|
||||
|
|
@ -81,7 +92,7 @@ Item {
|
|||
iconCircleColor: Color.mPrimary
|
||||
collapsedIconColor: Color.mOnSurface
|
||||
autoHide: false
|
||||
forceOpen: isReady && (testMode || battery.isLaptopBattery) && Settings.data.bar.alwaysShowBatteryPercentage
|
||||
forceOpen: isReady && (testMode || battery.isLaptopBattery) && alwaysShowPercentage
|
||||
disableOpen: (!isReady || (!testMode && !battery.isLaptopBattery))
|
||||
tooltipText: {
|
||||
let lines = []
|
||||
|
|
|
|||
|
|
@ -71,23 +71,6 @@ Item {
|
|||
onTriggered: pill.hide()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].alwaysShowPercentage === undefined
|
||||
&& Settings.data.bar.alwaysShowBatteryPercentage !== undefined) {
|
||||
widgets[sectionWidgetIndex].alwaysShowPercentage = Settings.data.bar.alwaysShowBatteryPercentage
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
|
|
|
|||
|
|
@ -218,30 +218,6 @@ RowLayout {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
var w = widgets[sectionWidgetIndex]
|
||||
if (w.showAlbumArt === undefined && Settings.data.audio.showMiniplayerAlbumArt !== undefined) {
|
||||
w.showAlbumArt = Settings.data.audio.showMiniplayerAlbumArt
|
||||
}
|
||||
if (w.showVisualizer === undefined && Settings.data.audio.showMiniplayerCava !== undefined) {
|
||||
w.showVisualizer = Settings.data.audio.showMiniplayerCava
|
||||
}
|
||||
if ((w.visualizerType === undefined || w.visualizerType === "")
|
||||
&& (Settings.data.audio.visualizerType !== undefined && Settings.data.audio.visualizerType !== "")) {
|
||||
w.visualizerType = Settings.data.audio.visualizerType
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NTooltip {
|
||||
id: tooltip
|
||||
text: {
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ Item {
|
|||
return {}
|
||||
}
|
||||
|
||||
readonly property bool userAlwaysShowPercentage: (widgetSettings.alwaysShowPercentage
|
||||
!== undefined) ? widgetSettings.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Microphone"].alwaysShowPercentage
|
||||
readonly property bool userAlwaysShowPercentage: widgetSettings?.alwaysShowPercentage
|
||||
|
||||
// Used to avoid opening the pill on Quickshell startup
|
||||
property bool firstInputVolumeReceived: false
|
||||
|
|
@ -83,23 +82,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].alwaysShowPercentage === undefined
|
||||
&& Settings.data.bar.alwaysShowBatteryPercentage !== undefined) {
|
||||
widgets[sectionWidgetIndex].alwaysShowPercentage = Settings.data.bar.alwaysShowBatteryPercentage
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
|
|
|
|||
|
|
@ -41,23 +41,6 @@ NIconButton {
|
|||
onClicked: PanelService.getPanel("sidePanel")?.toggle(screen, this)
|
||||
onRightClicked: PanelService.getPanel("settingsPanel")?.toggle(screen)
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].useDistroLogo === undefined
|
||||
&& Settings.data.bar.useDistroLogo !== undefined) {
|
||||
widgets[sectionWidgetIndex].useDistroLogo = Settings.data.bar.useDistroLogo
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
IconImage {
|
||||
id: logo
|
||||
anchors.centerIn: parent
|
||||
|
|
|
|||
|
|
@ -32,23 +32,6 @@ RowLayout {
|
|||
readonly property bool userShowNetworkStats: (widgetSettings.showNetworkStats
|
||||
!== undefined) ? widgetSettings.showNetworkStats : ((Settings.data.bar.showNetworkStats !== undefined) ? Settings.data.bar.showNetworkStats : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showNetworkStats)
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].showNetworkStats === undefined
|
||||
&& Settings.data.bar.showNetworkStats !== undefined) {
|
||||
widgets[sectionWidgetIndex].showNetworkStats = Settings.data.bar.showNetworkStats
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
spacing: Style.marginS * scaling
|
||||
|
||||
|
|
|
|||
|
|
@ -67,23 +67,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].alwaysShowPercentage === undefined
|
||||
&& Settings.data.bar.alwaysShowBatteryPercentage !== undefined) {
|
||||
widgets[sectionWidgetIndex].alwaysShowPercentage = Settings.data.bar.alwaysShowBatteryPercentage
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
NPill {
|
||||
id: pill
|
||||
|
||||
|
|
|
|||
|
|
@ -67,20 +67,6 @@ Item {
|
|||
|
||||
Component.onCompleted: {
|
||||
refreshWorkspaces()
|
||||
try {
|
||||
var section = barSection.replace("Section", "").toLowerCase()
|
||||
if (section && sectionWidgetIndex >= 0) {
|
||||
var widgets = Settings.data.bar.widgets[section]
|
||||
if (widgets && sectionWidgetIndex < widgets.length) {
|
||||
if (widgets[sectionWidgetIndex].labelMode === undefined
|
||||
&& Settings.data.bar.showWorkspaceLabel !== undefined) {
|
||||
widgets[sectionWidgetIndex].labelMode = Settings.data.bar.showWorkspaceLabel
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
|
|
|
|||
126
Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml
Normal file
126
Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
import "./WidgetSettings" as WidgetSettings
|
||||
|
||||
// Widget Settings Dialog Component
|
||||
Popup {
|
||||
id: settingsPopup
|
||||
|
||||
property int widgetIndex: -1
|
||||
property var widgetData: null
|
||||
property string widgetId: ""
|
||||
|
||||
// Center popup in parent
|
||||
x: (parent.width - width) * 0.5
|
||||
y: (parent.height - height) * 0.5
|
||||
|
||||
width: 420 * scaling
|
||||
height: content.implicitHeight + padding * 2
|
||||
padding: Style.marginXL * scaling
|
||||
modal: true
|
||||
|
||||
background: Rectangle {
|
||||
id: bgRect
|
||||
color: Color.mSurface
|
||||
radius: Style.radiusL * scaling
|
||||
border.color: Color.mPrimary
|
||||
border.width: Style.borderM * scaling
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
width: parent.width
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Title
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: `${settingsPopup.widgetId} Settings`
|
||||
font.pointSize: Style.fontSizeL * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mPrimary
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
icon: "close"
|
||||
onClicked: settingsPopup.close()
|
||||
}
|
||||
}
|
||||
|
||||
// Separator
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 1
|
||||
color: Color.mOutline
|
||||
}
|
||||
|
||||
// Settings based on widget type
|
||||
Loader {
|
||||
id: settingsLoader
|
||||
Layout.fillWidth: true
|
||||
|
||||
source: {
|
||||
const widgetSettingsMap = {
|
||||
"ActiveWindow": "WidgetSettings/ActiveWindowSettings.qml",
|
||||
"Battery": "WidgetSettings/BatterySettings.qml",
|
||||
"Brightness": "WidgetSettings/BrightnessSettings.qml",
|
||||
"Clock": "WidgetSettings/ClockSettings.qml",
|
||||
"CustomButton": "WidgetSettings/CustomButtonSettings.qml",
|
||||
"MediaMini": "WidgetSettings/MediaMiniSettings.qml",
|
||||
"Microphone": "WidgetSettings/MicrophoneSettings.qml",
|
||||
"NotificationHistory": "WidgetSettings/NotificationHistorySettings.qml",
|
||||
"Workspace": "WidgetSettings/WorkspaceSettings.qml",
|
||||
"SidePanelToggle": "WidgetSettings/SidePanelToggleSettings.qml",
|
||||
"Spacer": "WidgetSettings/SpacerSettings.qml",
|
||||
"SystemMonitor": "WidgetSettings/SystemMonitorSettings.qml",
|
||||
"Volume": "WidgetSettings/VolumeSettings.qml"
|
||||
}
|
||||
return widgetSettingsMap[settingsPopup.widgetId] || ""
|
||||
}
|
||||
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
// Pass data to the loaded component
|
||||
item.widgetData = settingsPopup.widgetData
|
||||
item.widgetMetadata = BarWidgetRegistry.widgetMetadata[settingsPopup.widgetId]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Action buttons
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginM * scaling
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NButton {
|
||||
text: "Cancel"
|
||||
outlined: true
|
||||
onClicked: settingsPopup.close()
|
||||
}
|
||||
|
||||
NButton {
|
||||
text: "Apply"
|
||||
icon: "check"
|
||||
onClicked: {
|
||||
if (settingsLoader.item && settingsLoader.item.saveSettings) {
|
||||
var newSettings = settingsLoader.item.saveSettings()
|
||||
root.updateWidgetSettings(sectionId, settingsPopup.widgetIndex, newSettings)
|
||||
settingsPopup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueShowIcon: widgetData.showIcon !== undefined ? widgetData.showIcon : widgetMetadata.showIcon
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.showIcon = valueShowIcon
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showIcon
|
||||
Layout.fillWidth: true
|
||||
label: "Show app icon"
|
||||
checked: root.valueShowIcon
|
||||
onToggled: checked => root.valueShowIcon = checked
|
||||
}
|
||||
}
|
||||
31
Modules/SettingsPanel/Bar/WidgetSettings/BatterySettings.qml
Normal file
31
Modules/SettingsPanel/Bar/WidgetSettings/BatterySettings.qml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: widgetData.alwaysShowPercentage
|
||||
!== undefined ? widgetData.alwaysShowPercentage : widgetMetadata.alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: root.valueAlwaysShowPercentage
|
||||
onToggled: checked => root.valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: widgetData.alwaysShowPercentage
|
||||
!== undefined ? widgetData.alwaysShowPercentage : widgetMetadata.alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
54
Modules/SettingsPanel/Bar/WidgetSettings/ClockSettings.qml
Normal file
54
Modules/SettingsPanel/Bar/WidgetSettings/ClockSettings.qml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueShowDate: widgetData.showDate !== undefined ? widgetData.showDate : widgetMetadata.showDate
|
||||
property bool valueUse12h: widgetData.use12HourClock !== undefined ? widgetData.use12HourClock : widgetMetadata.use12HourClock
|
||||
property bool valueShowSeconds: widgetData.showSeconds !== undefined ? widgetData.showSeconds : widgetMetadata.showSeconds
|
||||
property bool valueReverseDayMonth: widgetData.reverseDayMonth !== undefined ? widgetData.reverseDayMonth : widgetMetadata.reverseDayMonth
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.showDate = valueShowDate
|
||||
settings.use12HourClock = valueUse12h
|
||||
settings.showSeconds = valueShowSeconds
|
||||
settings.reverseDayMonth = valueReverseDayMonth
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show date next to time"
|
||||
checked: valueShowDate
|
||||
onToggled: checked => valueShowDate = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Use 12-hour clock"
|
||||
checked: valueUse12h
|
||||
onToggled: checked => valueUse12h = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show seconds"
|
||||
checked: valueShowSeconds
|
||||
onToggled: checked => valueShowSeconds = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Reverse day and month"
|
||||
checked: valueReverseDayMonth
|
||||
onToggled: checked => valueReverseDayMonth = checked
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.icon = iconInput.text
|
||||
settings.leftClickExec = leftClickExecInput.text
|
||||
settings.rightClickExec = rightClickExecInput.text
|
||||
settings.middleClickExec = middleClickExecInput.text
|
||||
return settings
|
||||
}
|
||||
|
||||
// Icon setting
|
||||
NTextInput {
|
||||
id: iconInput
|
||||
Layout.fillWidth: true
|
||||
label: "Icon Name"
|
||||
description: "Choose a name from the Material Icon set."
|
||||
placeholderText: "Enter icon name (e.g., favorite, home, settings)"
|
||||
text: widgetData?.icon || widgetMetadata.icon
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: leftClickExecInput
|
||||
Layout.fillWidth: true
|
||||
label: "Left Click Command"
|
||||
placeholderText: "Enter command to execute (app or custom script)"
|
||||
text: widgetData?.leftClickExec || widgetMetadata.leftClickExec
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: rightClickExecInput
|
||||
Layout.fillWidth: true
|
||||
label: "Right Click Command"
|
||||
placeholderText: "Enter command to execute (app or custom script)"
|
||||
text: widgetData?.rightClickExec || widgetMetadata.rightClickExec
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: middleClickExecInput
|
||||
Layout.fillWidth: true
|
||||
label: "Middle Click Command"
|
||||
placeholderText: "Enter command to execute (app or custom script)"
|
||||
text: widgetData.middleClickExec || widgetMetadata.middleClickExec
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueShowAlbumArt: widgetData.showAlbumArt !== undefined ? widgetData.showAlbumArt : widgetMetadata.showAlbumArt
|
||||
property bool valueShowVisualizer: widgetData.showVisualizer !== undefined ? widgetData.showVisualizer : widgetMetadata.showVisualizer
|
||||
property string valueVisualizerType: widgetData.visualizerType || widgetMetadata.visualizerType
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.showAlbumArt = valueShowAlbumArt
|
||||
settings.showVisualizer = valueShowVisualizer
|
||||
settings.visualizerType = valueVisualizerType
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show album art"
|
||||
checked: valueShowAlbumArt
|
||||
onToggled: checked => valueShowAlbumArt = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show visualizer"
|
||||
checked: valueShowVisualizer
|
||||
onToggled: checked => valueShowVisualizer = checked
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
visible: valueShowVisualizer
|
||||
label: "Visualizer type"
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
key: "linear"
|
||||
name: "Linear"
|
||||
}
|
||||
ListElement {
|
||||
key: "mirrored"
|
||||
name: "Mirrored"
|
||||
}
|
||||
ListElement {
|
||||
key: "wave"
|
||||
name: "Wave"
|
||||
}
|
||||
}
|
||||
currentKey: valueVisualizerType
|
||||
onSelected: key => valueVisualizerType = key
|
||||
minimumWidth: 200 * scaling
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: widgetData.alwaysShowPercentage
|
||||
!== undefined ? widgetData.alwaysShowPercentage : widgetMetadata.alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueShowUnreadBadge: widgetData.showUnreadBadge !== undefined ? widgetData.showUnreadBadge : widgetMetadata.showUnreadBadge
|
||||
property bool valueHideWhenZero: widgetData.hideWhenZero !== undefined ? widgetData.hideWhenZero : widgetMetadata.hideWhenZero
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.showUnreadBadge = valueShowUnreadBadge
|
||||
settings.hideWhenZero = valueHideWhenZero
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show unread badge"
|
||||
checked: valueShowUnreadBadge
|
||||
onToggled: checked => valueShowUnreadBadge = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Hide badge when zero"
|
||||
checked: valueHideWhenZero
|
||||
onToggled: checked => valueHideWhenZero = checked
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueUseDistroLogo: widgetData.useDistroLogo !== undefined ? widgetData.useDistroLogo : widgetMetadata.useDistroLogo
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.useDistroLogo = valueUseDistroLogo
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Use distro logo instead of icon"
|
||||
checked: valueUseDistroLogo
|
||||
onToggled: checked => valueUseDistroLogo = checked
|
||||
}
|
||||
}
|
||||
30
Modules/SettingsPanel/Bar/WidgetSettings/SpacerSettings.qml
Normal file
30
Modules/SettingsPanel/Bar/WidgetSettings/SpacerSettings.qml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.width = parseInt(widthInput.text) || widgetMetadata.width
|
||||
return settings
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: widthInput
|
||||
Layout.fillWidth: true
|
||||
label: "Width"
|
||||
description: "Spacing width in pixels"
|
||||
text: widgetData.width || widgetMetadata.width
|
||||
placeholderText: "Enter width in pixels"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local, editable state for checkboxes
|
||||
property bool valueShowCpuUsage: widgetData.showCpuUsage !== undefined ? widgetData.showCpuUsage : widgetMetadata.showCpuUsage
|
||||
property bool valueShowCpuTemp: widgetData.showCpuTemp !== undefined ? widgetData.showCpuTemp : widgetMetadata.showCpuTemp
|
||||
property bool valueShowMemoryUsage: widgetData.showMemoryUsage !== undefined ? widgetData.showMemoryUsage : widgetMetadata.showMemoryUsage
|
||||
property bool valueShowNetworkStats: widgetData.showNetworkStats
|
||||
!== undefined ? widgetData.showNetworkStats : widgetMetadata.showNetworkStats
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.showCpuUsage = valueShowCpuUsage
|
||||
settings.showCpuTemp = valueShowCpuTemp
|
||||
settings.showMemoryUsage = valueShowMemoryUsage
|
||||
settings.showNetworkStats = valueShowNetworkStats
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showCpuUsage
|
||||
Layout.fillWidth: true
|
||||
label: "CPU usage"
|
||||
checked: valueShowCpuUsage
|
||||
onToggled: checked => valueShowCpuUsage = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showCpuTemp
|
||||
Layout.fillWidth: true
|
||||
label: "CPU temperature"
|
||||
checked: valueShowCpuTemp
|
||||
onToggled: checked => valueShowCpuTemp = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showMemoryUsage
|
||||
Layout.fillWidth: true
|
||||
label: "Memory usage"
|
||||
checked: valueShowMemoryUsage
|
||||
onToggled: checked => valueShowMemoryUsage = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showNetworkStats
|
||||
Layout.fillWidth: true
|
||||
label: "Network traffic"
|
||||
checked: valueShowNetworkStats
|
||||
onToggled: checked => valueShowNetworkStats = checked
|
||||
}
|
||||
}
|
||||
31
Modules/SettingsPanel/Bar/WidgetSettings/VolumeSettings.qml
Normal file
31
Modules/SettingsPanel/Bar/WidgetSettings/VolumeSettings.qml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: widgetData.alwaysShowPercentage
|
||||
!== undefined ? widgetData.alwaysShowPercentage : widgetMetadata.alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Properties to receive data from parent
|
||||
property var widgetData: null
|
||||
property var widgetMetadata: null
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.labelMode = labelModeCombo.currentKey
|
||||
return settings
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
id: labelModeCombo
|
||||
|
||||
label: "Label Mode"
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
key: "none"
|
||||
name: "None"
|
||||
}
|
||||
ListElement {
|
||||
key: "index"
|
||||
name: "Index"
|
||||
}
|
||||
ListElement {
|
||||
key: "name"
|
||||
name: "Name"
|
||||
}
|
||||
}
|
||||
currentKey: widgetData.labelMode || widgetMetadata.labelMode
|
||||
onSelected: key => labelModeCombo.currentKey = key
|
||||
minimumWidth: 200 * scaling
|
||||
}
|
||||
}
|
||||
|
|
@ -1,578 +0,0 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import qs.Commons
|
||||
import qs.Widgets
|
||||
import qs.Services
|
||||
|
||||
// Widget Settings Dialog Component
|
||||
Popup {
|
||||
id: settingsPopup
|
||||
|
||||
property int widgetIndex: -1
|
||||
property var widgetData: null
|
||||
property string widgetId: ""
|
||||
|
||||
// Center popup in parent
|
||||
x: (parent.width - width) * 0.5
|
||||
y: (parent.height - height) * 0.5
|
||||
|
||||
width: 420 * scaling
|
||||
height: content.implicitHeight + padding * 2
|
||||
padding: Style.marginXL * scaling
|
||||
modal: true
|
||||
|
||||
background: Rectangle {
|
||||
id: bgRect
|
||||
color: Color.mSurface
|
||||
radius: Style.radiusL * scaling
|
||||
border.color: Color.mPrimary
|
||||
border.width: Style.borderM * scaling
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
width: parent.width
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Title
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
NText {
|
||||
text: "Widget Settings: " + settingsPopup.widgetId
|
||||
font.pointSize: Style.fontSizeL * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
color: Color.mPrimary
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
icon: "close"
|
||||
onClicked: settingsPopup.close()
|
||||
}
|
||||
}
|
||||
|
||||
// Separator
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 1
|
||||
color: Color.mOutline
|
||||
}
|
||||
|
||||
// Settings based on widget type
|
||||
Loader {
|
||||
id: settingsLoader
|
||||
Layout.fillWidth: true
|
||||
sourceComponent: {
|
||||
if (settingsPopup.widgetId === "CustomButton") {
|
||||
return customButtonSettings
|
||||
} else if (settingsPopup.widgetId === "Spacer") {
|
||||
return spacerSettings
|
||||
} else if (settingsPopup.widgetId === "Workspace") {
|
||||
return workspaceSettings
|
||||
} else if (settingsPopup.widgetId === "SystemMonitor") {
|
||||
return systemMonitorSettings
|
||||
} else if (settingsPopup.widgetId === "ActiveWindow") {
|
||||
return activeWindowSettings
|
||||
} else if (settingsPopup.widgetId === "MediaMini") {
|
||||
return mediaMiniSettings
|
||||
} else if (settingsPopup.widgetId === "Clock") {
|
||||
return clockSettings
|
||||
} else if (settingsPopup.widgetId === "Volume") {
|
||||
return volumeSettings
|
||||
} else if (settingsPopup.widgetId === "Microphone") {
|
||||
return microphoneSettings
|
||||
} else if (settingsPopup.widgetId === "NotificationHistory") {
|
||||
return notificationHistorySettings
|
||||
} else if (settingsPopup.widgetId === "Brightness") {
|
||||
return brightnessSettings
|
||||
} else if (settingsPopup.widgetId === "SidePanelToggle") {
|
||||
return sidePanelToggleSettings
|
||||
}
|
||||
// Add more widget settings components here as needed
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
// Action buttons
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginM * scaling
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
NButton {
|
||||
text: "Cancel"
|
||||
outlined: true
|
||||
onClicked: settingsPopup.close()
|
||||
}
|
||||
|
||||
NButton {
|
||||
text: "Apply"
|
||||
icon: "check"
|
||||
onClicked: {
|
||||
if (settingsLoader.item && settingsLoader.item.saveSettings) {
|
||||
var newSettings = settingsLoader.item.saveSettings()
|
||||
root.updateWidgetSettings(sectionId, settingsPopup.widgetIndex, newSettings)
|
||||
settingsPopup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SidePanelToggle settings component
|
||||
Component {
|
||||
id: sidePanelToggleSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueUseDistroLogo: settingsPopup.widgetData.useDistroLogo
|
||||
!== undefined ? settingsPopup.widgetData.useDistroLogo : BarWidgetRegistry.widgetMetadata["SidePanelToggle"].useDistroLogo
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.useDistroLogo = valueUseDistroLogo
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Use distro logo instead of icon"
|
||||
checked: valueUseDistroLogo
|
||||
onToggled: checked => valueUseDistroLogo = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Brightness settings component
|
||||
Component {
|
||||
id: brightnessSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: settingsPopup.widgetData.alwaysShowPercentage
|
||||
!== undefined ? settingsPopup.widgetData.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Brightness"].alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NotificationHistory settings component
|
||||
Component {
|
||||
id: notificationHistorySettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueShowUnreadBadge: settingsPopup.widgetData.showUnreadBadge
|
||||
!== undefined ? settingsPopup.widgetData.showUnreadBadge : BarWidgetRegistry.widgetMetadata["NotificationHistory"].showUnreadBadge
|
||||
property bool valueHideWhenZero: settingsPopup.widgetData.hideWhenZero
|
||||
!== undefined ? settingsPopup.widgetData.hideWhenZero : BarWidgetRegistry.widgetMetadata["NotificationHistory"].hideWhenZero
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showUnreadBadge = valueShowUnreadBadge
|
||||
settings.hideWhenZero = valueHideWhenZero
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show unread badge"
|
||||
checked: valueShowUnreadBadge
|
||||
onToggled: checked => valueShowUnreadBadge = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Hide badge when zero"
|
||||
checked: valueHideWhenZero
|
||||
onToggled: checked => valueHideWhenZero = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Microphone settings component
|
||||
Component {
|
||||
id: microphoneSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: settingsPopup.widgetData.alwaysShowPercentage
|
||||
!== undefined ? settingsPopup.widgetData.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Microphone"].alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Volume settings component
|
||||
Component {
|
||||
id: volumeSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueAlwaysShowPercentage: settingsPopup.widgetData.alwaysShowPercentage
|
||||
!== undefined ? settingsPopup.widgetData.alwaysShowPercentage : BarWidgetRegistry.widgetMetadata["Volume"].alwaysShowPercentage
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.alwaysShowPercentage = valueAlwaysShowPercentage
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Always show percentage"
|
||||
checked: valueAlwaysShowPercentage
|
||||
onToggled: checked => valueAlwaysShowPercentage = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clock settings component
|
||||
Component {
|
||||
id: clockSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueShowDate: settingsPopup.widgetData.showDate
|
||||
!== undefined ? settingsPopup.widgetData.showDate : BarWidgetRegistry.widgetMetadata["Clock"].showDate
|
||||
property bool valueUse12h: settingsPopup.widgetData.use12HourClock
|
||||
!== undefined ? settingsPopup.widgetData.use12HourClock : BarWidgetRegistry.widgetMetadata["Clock"].use12HourClock
|
||||
property bool valueShowSeconds: settingsPopup.widgetData.showSeconds
|
||||
!== undefined ? settingsPopup.widgetData.showSeconds : BarWidgetRegistry.widgetMetadata["Clock"].showSeconds
|
||||
property bool valueReverseDayMonth: settingsPopup.widgetData.reverseDayMonth
|
||||
!== undefined ? settingsPopup.widgetData.reverseDayMonth : BarWidgetRegistry.widgetMetadata["Clock"].reverseDayMonth
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showDate = valueShowDate
|
||||
settings.use12HourClock = valueUse12h
|
||||
settings.showSeconds = valueShowSeconds
|
||||
settings.reverseDayMonth = valueReverseDayMonth
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show date next to time"
|
||||
checked: valueShowDate
|
||||
onToggled: checked => valueShowDate = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Use 12-hour clock"
|
||||
checked: valueUse12h
|
||||
onToggled: checked => valueUse12h = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show seconds"
|
||||
checked: valueShowSeconds
|
||||
onToggled: checked => valueShowSeconds = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Reverse day and month"
|
||||
checked: valueReverseDayMonth
|
||||
onToggled: checked => valueReverseDayMonth = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MediaMini settings component
|
||||
Component {
|
||||
id: mediaMiniSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local state
|
||||
property bool valueShowAlbumArt: settingsPopup.widgetData.showAlbumArt
|
||||
!== undefined ? settingsPopup.widgetData.showAlbumArt : BarWidgetRegistry.widgetMetadata["MediaMini"].showAlbumArt
|
||||
property bool valueShowVisualizer: settingsPopup.widgetData.showVisualizer
|
||||
!== undefined ? settingsPopup.widgetData.showVisualizer : BarWidgetRegistry.widgetMetadata["MediaMini"].showVisualizer
|
||||
property string valueVisualizerType: settingsPopup.widgetData.visualizerType
|
||||
|| BarWidgetRegistry.widgetMetadata["MediaMini"].visualizerType
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showAlbumArt = valueShowAlbumArt
|
||||
settings.showVisualizer = valueShowVisualizer
|
||||
settings.visualizerType = valueVisualizerType
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show album art"
|
||||
checked: valueShowAlbumArt
|
||||
onToggled: checked => valueShowAlbumArt = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
label: "Show visualizer"
|
||||
checked: valueShowVisualizer
|
||||
onToggled: checked => valueShowVisualizer = checked
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
label: "Visualizer type"
|
||||
description: "Select the visualizer style"
|
||||
preferredWidth: 180 * scaling
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
key: "linear"
|
||||
name: "Linear"
|
||||
}
|
||||
ListElement {
|
||||
key: "mirrored"
|
||||
name: "Mirrored"
|
||||
}
|
||||
ListElement {
|
||||
key: "wave"
|
||||
name: "Wave"
|
||||
}
|
||||
}
|
||||
currentKey: valueVisualizerType
|
||||
onSelected: key => valueVisualizerType = key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ActiveWindow settings component
|
||||
Component {
|
||||
id: activeWindowSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local, editable state
|
||||
property bool valueShowIcon: settingsPopup.widgetData.showIcon
|
||||
!== undefined ? settingsPopup.widgetData.showIcon : BarWidgetRegistry.widgetMetadata["ActiveWindow"].showIcon
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showIcon = valueShowIcon
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showIcon
|
||||
Layout.fillWidth: true
|
||||
label: "Show app icon"
|
||||
checked: valueShowIcon
|
||||
onToggled: checked => valueShowIcon = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CustomButton settings component
|
||||
Component {
|
||||
id: customButtonSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.icon = iconInput.text
|
||||
settings.leftClickExec = leftClickExecInput.text
|
||||
settings.rightClickExec = rightClickExecInput.text
|
||||
settings.middleClickExec = middleClickExecInput.text
|
||||
return settings
|
||||
}
|
||||
|
||||
// Icon setting
|
||||
NTextInput {
|
||||
id: iconInput
|
||||
Layout.fillWidth: true
|
||||
Layout.bottomMargin: Style.marginXL * scaling
|
||||
label: "Icon Name"
|
||||
description: "Use Material Icon names from the icon set."
|
||||
text: settingsPopup.widgetData.icon || ""
|
||||
placeholderText: "Enter icon name (e.g., favorite, home, settings)"
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: leftClickExecInput
|
||||
Layout.fillWidth: true
|
||||
label: "Left Click Command"
|
||||
description: "Command or application to run when left clicked."
|
||||
text: settingsPopup.widgetData.leftClickExec || ""
|
||||
placeholderText: "Enter command to execute (app or custom script)"
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: rightClickExecInput
|
||||
Layout.fillWidth: true
|
||||
label: "Right Click Command"
|
||||
description: "Command or application to run when right clicked."
|
||||
text: settingsPopup.widgetData.rightClickExec || ""
|
||||
placeholderText: "Enter command to execute (app or custom script)"
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: middleClickExecInput
|
||||
Layout.fillWidth: true
|
||||
label: "Middle Click Command"
|
||||
description: "Command or application to run when middle clicked."
|
||||
text: settingsPopup.widgetData.middleClickExec || ""
|
||||
placeholderText: "Enter command to execute (app or custom script)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Spacer settings component
|
||||
Component {
|
||||
id: spacerSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.width = parseInt(widthInput.text) || 20
|
||||
return settings
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: widthInput
|
||||
Layout.fillWidth: true
|
||||
label: "Width (pixels)"
|
||||
description: "Width of the spacer in pixels."
|
||||
text: settingsPopup.widgetData.width || "20"
|
||||
placeholderText: "Enter width in pixels"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace settings component
|
||||
Component {
|
||||
id: workspaceSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.labelMode = labelModeCombo.currentKey
|
||||
return settings
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
id: labelModeCombo
|
||||
Layout.fillWidth: true
|
||||
preferredWidth: 180 * scaling
|
||||
label: "Label Mode"
|
||||
description: "Choose how to label workspace pills."
|
||||
model: ListModel {
|
||||
ListElement {
|
||||
key: "none"
|
||||
name: "None"
|
||||
}
|
||||
ListElement {
|
||||
key: "index"
|
||||
name: "Index"
|
||||
}
|
||||
ListElement {
|
||||
key: "name"
|
||||
name: "Name"
|
||||
}
|
||||
}
|
||||
currentKey: settingsPopup.widgetData.labelMode || BarWidgetRegistry.widgetMetadata["Workspace"].labelMode
|
||||
onSelected: key => labelModeCombo.currentKey = key
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SystemMonitor settings component
|
||||
Component {
|
||||
id: systemMonitorSettings
|
||||
|
||||
ColumnLayout {
|
||||
spacing: Style.marginM * scaling
|
||||
|
||||
// Local, editable state for checkboxes
|
||||
property bool valueShowCpuUsage: settingsPopup.widgetData.showCpuUsage
|
||||
!== undefined ? settingsPopup.widgetData.showCpuUsage : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showCpuUsage
|
||||
property bool valueShowCpuTemp: settingsPopup.widgetData.showCpuTemp
|
||||
!== undefined ? settingsPopup.widgetData.showCpuTemp : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showCpuTemp
|
||||
property bool valueShowMemoryUsage: settingsPopup.widgetData.showMemoryUsage
|
||||
!== undefined ? settingsPopup.widgetData.showMemoryUsage : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showMemoryUsage
|
||||
property bool valueShowNetworkStats: settingsPopup.widgetData.showNetworkStats
|
||||
!== undefined ? settingsPopup.widgetData.showNetworkStats : BarWidgetRegistry.widgetMetadata["SystemMonitor"].showNetworkStats
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, settingsPopup.widgetData)
|
||||
settings.showCpuUsage = valueShowCpuUsage
|
||||
settings.showCpuTemp = valueShowCpuTemp
|
||||
settings.showMemoryUsage = valueShowMemoryUsage
|
||||
settings.showNetworkStats = valueShowNetworkStats
|
||||
return settings
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showCpuUsage
|
||||
Layout.fillWidth: true
|
||||
label: "CPU usage"
|
||||
checked: valueShowCpuUsage
|
||||
onToggled: checked => valueShowCpuUsage = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showCpuTemp
|
||||
Layout.fillWidth: true
|
||||
label: "CPU temperature"
|
||||
checked: valueShowCpuTemp
|
||||
onToggled: checked => valueShowCpuTemp = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showMemoryUsage
|
||||
Layout.fillWidth: true
|
||||
label: "Memory usage"
|
||||
checked: valueShowMemoryUsage
|
||||
onToggled: checked => valueShowMemoryUsage = checked
|
||||
}
|
||||
|
||||
NCheckbox {
|
||||
id: showNetworkStats
|
||||
Layout.fillWidth: true
|
||||
label: "Network traffic"
|
||||
checked: valueShowNetworkStats
|
||||
onToggled: checked => valueShowNetworkStats = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@ import QtQuick.Layouts
|
|||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.SettingsPanel.Extras
|
||||
import qs.Modules.SettingsPanel.Bar
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
|
@ -70,14 +70,6 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Keep Battery toggle here for now (cannot test per-widget yet)
|
||||
NToggle {
|
||||
label: "Show Battery Percentage"
|
||||
description: "Display battery percentage at all times."
|
||||
checked: Settings.data.bar.alwaysShowBatteryPercentage
|
||||
onToggled: checked => Settings.data.bar.alwaysShowBatteryPercentage = checked
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
|
|
|
|||
|
|
@ -47,17 +47,16 @@ Singleton {
|
|||
},
|
||||
"Spacer": {
|
||||
"allowUserSettings": true,
|
||||
"icon": "space_bar",
|
||||
"width": 20
|
||||
},
|
||||
"ActiveWindow"// Per-instance settings for common widgets shown in BarTab
|
||||
: {
|
||||
"ActiveWindow": {
|
||||
"allowUserSettings": true,
|
||||
"showIcon": true
|
||||
},
|
||||
"Battery": {
|
||||
"allowUserSettings": true,
|
||||
"alwaysShowPercentage": false
|
||||
"alwaysShowPercentage": false,
|
||||
"warningThreshold": 30
|
||||
},
|
||||
"SystemMonitor": {
|
||||
"allowUserSettings": true,
|
||||
|
|
@ -68,15 +67,13 @@ Singleton {
|
|||
},
|
||||
"Workspace": {
|
||||
"allowUserSettings": true,
|
||||
"labelMode"// none | index | name
|
||||
: "index"
|
||||
"labelMode": "index"
|
||||
},
|
||||
"MediaMini": {
|
||||
"allowUserSettings": true,
|
||||
"showAlbumArt": false,
|
||||
"showVisualizer": false,
|
||||
"visualizerType"// linear | mirrored | wave
|
||||
: "linear"
|
||||
"visualizerType": "linear"
|
||||
},
|
||||
"Clock": {
|
||||
"allowUserSettings": true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue