mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-25 05:52:50 -05:00
Fix reactivity, different settings structure, etc, etc.
This commit is contained in:
@@ -8,6 +8,15 @@ import qs.Widgets
|
||||
Item {
|
||||
id: dankBarTab
|
||||
|
||||
function getWidgetsForPopup() {
|
||||
return baseWidgetDefinitions.filter(widget => {
|
||||
if (widget.warning && widget.warning.includes("Plugin is disabled")) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
property var baseWidgetDefinitions: {
|
||||
var coreWidgets = [{
|
||||
"id": "launcherButton",
|
||||
@@ -179,16 +188,18 @@ Item {
|
||||
"enabled": SystemUpdateService.distributionSupported
|
||||
}]
|
||||
|
||||
// Add plugin widgets dynamically
|
||||
var loadedPlugins = PluginService.getLoadedPlugins()
|
||||
for (var i = 0; i < loadedPlugins.length; i++) {
|
||||
var plugin = loadedPlugins[i]
|
||||
// Add all available plugins (loaded and unloaded)
|
||||
var allPlugins = PluginService.getAvailablePlugins()
|
||||
for (var i = 0; i < allPlugins.length; i++) {
|
||||
var plugin = allPlugins[i]
|
||||
var isLoaded = PluginService.isPluginLoaded(plugin.id)
|
||||
coreWidgets.push({
|
||||
"id": plugin.id,
|
||||
"text": plugin.name,
|
||||
"description": plugin.description || "Plugin widget",
|
||||
"icon": plugin.icon || "extension",
|
||||
"enabled": true
|
||||
"enabled": isLoaded,
|
||||
"warning": !isLoaded ? "Plugin is disabled - enable in Plugins settings to use" : undefined
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1146,7 +1157,7 @@ Item {
|
||||
}
|
||||
onAddWidget: sectionId => {
|
||||
widgetSelectionPopup.allWidgets
|
||||
= dankBarTab.baseWidgetDefinitions
|
||||
= dankBarTab.getWidgetsForPopup()
|
||||
widgetSelectionPopup.targetSection = sectionId
|
||||
widgetSelectionPopup.safeOpen()
|
||||
}
|
||||
@@ -1218,7 +1229,7 @@ Item {
|
||||
}
|
||||
onAddWidget: sectionId => {
|
||||
widgetSelectionPopup.allWidgets
|
||||
= dankBarTab.baseWidgetDefinitions
|
||||
= dankBarTab.getWidgetsForPopup()
|
||||
widgetSelectionPopup.targetSection = sectionId
|
||||
widgetSelectionPopup.safeOpen()
|
||||
}
|
||||
@@ -1290,7 +1301,7 @@ Item {
|
||||
}
|
||||
onAddWidget: sectionId => {
|
||||
widgetSelectionPopup.allWidgets
|
||||
= dankBarTab.baseWidgetDefinitions
|
||||
= dankBarTab.getWidgetsForPopup()
|
||||
widgetSelectionPopup.targetSection = sectionId
|
||||
widgetSelectionPopup.safeOpen()
|
||||
}
|
||||
|
||||
@@ -520,7 +520,6 @@ Item {
|
||||
DankDropdown {
|
||||
id: monitorDropdown
|
||||
|
||||
width: parent.width - parent.leftPadding
|
||||
text: "Monitor"
|
||||
description: "Select monitor to configure wallpaper"
|
||||
currentValue: selectedMonitorName || "No monitors"
|
||||
@@ -678,7 +677,6 @@ Item {
|
||||
property var intervalOptions: ["1 minute", "5 minutes", "15 minutes", "30 minutes", "1 hour", "1.5 hours", "2 hours", "3 hours", "4 hours", "6 hours", "8 hours", "12 hours"]
|
||||
property var intervalValues: [60, 300, 900, 1800, 3600, 5400, 7200, 10800, 14400, 21600, 28800, 43200]
|
||||
|
||||
width: parent.width - parent.leftPadding
|
||||
visible: {
|
||||
if (SessionData.perMonitorWallpaper) {
|
||||
return SessionData.getMonitorCyclingSettings(selectedMonitorName).mode === "interval"
|
||||
@@ -833,7 +831,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
text: "Transition Effect"
|
||||
description: "Visual effect used when wallpaper changes"
|
||||
currentValue: {
|
||||
@@ -851,8 +848,6 @@ Item {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingS
|
||||
visible: SessionData.wallpaperTransition === "random"
|
||||
leftPadding: Theme.spacingM
|
||||
rightPadding: Theme.spacingM
|
||||
|
||||
StyledText {
|
||||
text: "Include Transitions"
|
||||
@@ -866,12 +861,12 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width - parent.leftPadding - parent.rightPadding
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
DankButtonGroup {
|
||||
id: transitionGroup
|
||||
width: parent.width - parent.leftPadding - parent.rightPadding
|
||||
width: parent.width
|
||||
selectionMode: "multi"
|
||||
model: SessionData.availableWallpaperTransitions.filter(t => t !== "none")
|
||||
initialSelection: SessionData.includedTransitions
|
||||
@@ -959,7 +954,6 @@ Item {
|
||||
|
||||
DankDropdown {
|
||||
id: personalizationMatugenPaletteDropdown
|
||||
width: parent.width
|
||||
text: "Matugen Palette"
|
||||
description: "Select the palette algorithm used for wallpaper-based colors"
|
||||
options: Theme.availableMatugenSchemes.map(function (option) { return option.label })
|
||||
@@ -1075,7 +1069,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
text: "Temperature"
|
||||
description: "Color temperature for night mode"
|
||||
currentValue: SessionData.nightModeTemperature + "K"
|
||||
@@ -1424,7 +1417,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
text: "Popup Position"
|
||||
description: "Choose where notification popups appear on screen"
|
||||
currentValue: {
|
||||
@@ -1506,7 +1498,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
text: "Font Family"
|
||||
description: "Select system font family"
|
||||
currentValue: {
|
||||
@@ -1528,7 +1519,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
text: "Font Weight"
|
||||
description: "Select font weight"
|
||||
currentValue: {
|
||||
@@ -1595,7 +1585,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
text: "Monospace Font"
|
||||
description: "Select monospace font for process list and technical displays"
|
||||
currentValue: {
|
||||
|
||||
@@ -10,14 +10,6 @@ Item {
|
||||
|
||||
property string expandedPluginId: ""
|
||||
|
||||
Component.onCompleted: {
|
||||
console.log("PluginsTab: Component completed")
|
||||
console.log("PluginsTab: PluginService available:", typeof PluginService !== "undefined")
|
||||
if (typeof PluginService !== "undefined") {
|
||||
console.log("PluginsTab: Available plugins:", Object.keys(PluginService.availablePlugins).length)
|
||||
console.log("PluginsTab: Plugin directory:", PluginService.pluginDirectory)
|
||||
}
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
anchors.fill: parent
|
||||
@@ -186,9 +178,6 @@ Item {
|
||||
property bool hasSettings: pluginData && pluginData.settings !== undefined && pluginData.settings !== ""
|
||||
property bool isExpanded: pluginsTab.expandedPluginId === pluginId
|
||||
|
||||
onIsExpandedChanged: {
|
||||
console.log("Plugin", pluginId, "isExpanded changed to:", isExpanded)
|
||||
}
|
||||
|
||||
color: pluginMouseArea.containsMouse ? Theme.surfacePressed : (isExpanded ? Theme.surfaceContainerHighest : Theme.surfaceContainerHigh)
|
||||
border.width: 0
|
||||
@@ -200,15 +189,8 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: pluginDelegate.hasSettings ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
console.log("Plugin clicked:", pluginDelegate.pluginId, "hasSettings:", pluginDelegate.hasSettings, "isLoaded:", PluginService.isPluginLoaded(pluginDelegate.pluginId))
|
||||
if (pluginDelegate.hasSettings) {
|
||||
if (pluginsTab.expandedPluginId === pluginDelegate.pluginId) {
|
||||
console.log("Collapsing plugin:", pluginDelegate.pluginId)
|
||||
pluginsTab.expandedPluginId = ""
|
||||
} else {
|
||||
console.log("Expanding plugin:", pluginDelegate.pluginId)
|
||||
pluginsTab.expandedPluginId = pluginDelegate.pluginId
|
||||
}
|
||||
pluginsTab.expandedPluginId = pluginsTab.expandedPluginId === pluginDelegate.pluginId ? "" : pluginDelegate.pluginId
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,7 +216,7 @@ Item {
|
||||
}
|
||||
|
||||
Column {
|
||||
width: parent.width - Theme.iconSize - Theme.spacingM - pluginToggle.width - Theme.spacingM
|
||||
width: parent.width - Theme.iconSize - Theme.spacingM - toggleRow.width - Theme.spacingM
|
||||
spacing: Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -267,30 +249,69 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
id: pluginToggle
|
||||
Row {
|
||||
id: toggleRow
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: PluginService.isPluginLoaded(pluginDelegate.pluginId)
|
||||
onToggled: isChecked => {
|
||||
const currentPluginId = pluginDelegate.pluginId
|
||||
const currentPluginName = pluginDelegate.pluginName
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
if (isChecked) {
|
||||
if (PluginService.enablePlugin(currentPluginId)) {
|
||||
ToastService.showInfo("Plugin enabled: " + currentPluginName)
|
||||
} else {
|
||||
ToastService.showError("Failed to enable plugin: " + currentPluginName)
|
||||
checked = false
|
||||
Rectangle {
|
||||
width: 28
|
||||
height: 28
|
||||
radius: 14
|
||||
color: reloadArea.containsMouse ? Theme.surfaceContainerHighest : "transparent"
|
||||
visible: PluginService.isPluginLoaded(pluginDelegate.pluginId)
|
||||
|
||||
DankIcon {
|
||||
anchors.centerIn: parent
|
||||
name: "refresh"
|
||||
size: 16
|
||||
color: reloadArea.containsMouse ? Theme.primary : Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: reloadArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
const currentPluginId = pluginDelegate.pluginId
|
||||
const currentPluginName = pluginDelegate.pluginName
|
||||
pluginsTab.isReloading = true
|
||||
if (PluginService.reloadPlugin(currentPluginId)) {
|
||||
ToastService.showInfo("Plugin reloaded: " + currentPluginName)
|
||||
} else {
|
||||
ToastService.showError("Failed to reload plugin: " + currentPluginName)
|
||||
pluginsTab.isReloading = false
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (PluginService.disablePlugin(currentPluginId)) {
|
||||
ToastService.showInfo("Plugin disabled: " + currentPluginName)
|
||||
if (pluginDelegate.isExpanded) {
|
||||
expandedPluginId = ""
|
||||
}
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
id: pluginToggle
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: PluginService.isPluginLoaded(pluginDelegate.pluginId)
|
||||
onToggled: isChecked => {
|
||||
const currentPluginId = pluginDelegate.pluginId
|
||||
const currentPluginName = pluginDelegate.pluginName
|
||||
|
||||
if (isChecked) {
|
||||
if (PluginService.enablePlugin(currentPluginId)) {
|
||||
ToastService.showInfo("Plugin enabled: " + currentPluginName)
|
||||
} else {
|
||||
ToastService.showError("Failed to enable plugin: " + currentPluginName)
|
||||
checked = false
|
||||
}
|
||||
} else {
|
||||
ToastService.showError("Failed to disable plugin: " + currentPluginName)
|
||||
checked = true
|
||||
if (PluginService.disablePlugin(currentPluginId)) {
|
||||
ToastService.showInfo("Plugin disabled: " + currentPluginName)
|
||||
if (pluginDelegate.isExpanded) {
|
||||
expandedPluginId = ""
|
||||
}
|
||||
} else {
|
||||
ToastService.showError("Failed to disable plugin: " + currentPluginName)
|
||||
checked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -358,15 +379,8 @@ Item {
|
||||
active: pluginDelegate.isExpanded && pluginDelegate.hasSettings && PluginService.isPluginLoaded(pluginDelegate.pluginId)
|
||||
asynchronous: false
|
||||
|
||||
onActiveChanged: {
|
||||
console.log("Settings loader active changed to:", active, "for plugin:", pluginDelegate.pluginId,
|
||||
"isExpanded:", pluginDelegate.isExpanded, "hasSettings:", pluginDelegate.hasSettings,
|
||||
"isLoaded:", PluginService.isPluginLoaded(pluginDelegate.pluginId))
|
||||
}
|
||||
|
||||
source: {
|
||||
if (active && pluginDelegate.pluginSettingsPath) {
|
||||
console.log("Loading plugin settings from:", pluginDelegate.pluginSettingsPath)
|
||||
var path = pluginDelegate.pluginSettingsPath
|
||||
if (!path.startsWith("file://")) {
|
||||
path = "file://" + path
|
||||
@@ -376,37 +390,9 @@ Item {
|
||||
return ""
|
||||
}
|
||||
|
||||
onStatusChanged: {
|
||||
console.log("Settings loader status changed:", status, "for plugin:", pluginDelegate.pluginId)
|
||||
if (status === Loader.Error) {
|
||||
console.error("Failed to load plugin settings:", pluginDelegate.pluginSettingsPath)
|
||||
} else if (status === Loader.Ready) {
|
||||
console.log("Settings successfully loaded for plugin:", pluginDelegate.pluginId)
|
||||
}
|
||||
}
|
||||
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
console.log("Plugin settings loaded for:", pluginDelegate.pluginId)
|
||||
|
||||
if (typeof PluginService !== "undefined") {
|
||||
console.log("Making PluginService available to plugin settings")
|
||||
console.log("PluginService functions available:",
|
||||
"savePluginData" in PluginService,
|
||||
"loadPluginData" in PluginService)
|
||||
item.pluginService = PluginService
|
||||
console.log("PluginService assignment completed, item.pluginService:", item.pluginService !== null)
|
||||
} else {
|
||||
console.error("PluginService not available in PluginsTab context")
|
||||
}
|
||||
|
||||
if (item.loadTimezones) {
|
||||
console.log("Calling loadTimezones for WorldClock plugin")
|
||||
item.loadTimezones()
|
||||
}
|
||||
if (item.initializeSettings) {
|
||||
item.initializeSettings()
|
||||
}
|
||||
if (item && typeof PluginService !== "undefined") {
|
||||
item.pluginService = PluginService
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,14 +426,19 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
property bool isReloading: false
|
||||
|
||||
Connections {
|
||||
target: PluginService
|
||||
function onPluginLoaded() {
|
||||
pluginRepeater.model = PluginService.getAvailablePlugins()
|
||||
if (isReloading) {
|
||||
isReloading = false
|
||||
}
|
||||
}
|
||||
function onPluginUnloaded() {
|
||||
pluginRepeater.model = PluginService.getAvailablePlugins()
|
||||
if (pluginsTab.expandedPluginId !== "" && !PluginService.isPluginLoaded(pluginsTab.expandedPluginId)) {
|
||||
if (!isReloading && pluginsTab.expandedPluginId !== "" && !PluginService.isPluginLoaded(pluginsTab.expandedPluginId)) {
|
||||
pluginsTab.expandedPluginId = ""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,7 +651,6 @@ Item {
|
||||
|
||||
DankDropdown {
|
||||
id: matugenPaletteDropdown
|
||||
width: parent.width
|
||||
text: "Matugen Palette"
|
||||
description: "Select the palette algorithm used for wallpaper-based colors"
|
||||
options: Theme.availableMatugenSchemes.map(function (option) { return option.label })
|
||||
@@ -993,7 +992,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width - Theme.iconSize - Theme.spacingXS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Icon Theme"
|
||||
description: "DankShell & System Icons\n(requires restart)"
|
||||
|
||||
@@ -121,7 +121,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
height: 50
|
||||
text: "Top Bar Format"
|
||||
description: "Preview: " + (SettingsData.clockDateFormat ? new Date().toLocaleDateString(Qt.locale(), SettingsData.clockDateFormat) : new Date().toLocaleDateString(Qt.locale(), "ddd d"))
|
||||
@@ -185,7 +184,6 @@ Item {
|
||||
}
|
||||
|
||||
DankDropdown {
|
||||
width: parent.width
|
||||
height: 50
|
||||
text: "Lock Screen Format"
|
||||
description: "Preview: " + (SettingsData.lockDateFormat ? new Date().toLocaleDateString(Qt.locale(), SettingsData.lockDateFormat) : new Date().toLocaleDateString(Qt.locale(), Locale.LongFormat))
|
||||
|
||||
@@ -21,23 +21,23 @@ Popup {
|
||||
filteredWidgets = allWidgets.slice()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
var filtered = []
|
||||
var query = searchQuery.toLowerCase()
|
||||
|
||||
|
||||
for (var i = 0; i < allWidgets.length; i++) {
|
||||
var widget = allWidgets[i]
|
||||
var text = widget.text ? widget.text.toLowerCase() : ""
|
||||
var description = widget.description ? widget.description.toLowerCase() : ""
|
||||
var id = widget.id ? widget.id.toLowerCase() : ""
|
||||
|
||||
if (text.indexOf(query) !== -1 ||
|
||||
description.indexOf(query) !== -1 ||
|
||||
|
||||
if (text.indexOf(query) !== -1 ||
|
||||
description.indexOf(query) !== -1 ||
|
||||
id.indexOf(query) !== -1) {
|
||||
filtered.push(widget)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
filteredWidgets = filtered
|
||||
selectedIndex = -1
|
||||
keyboardNavigationActive = false
|
||||
|
||||
@@ -142,13 +142,14 @@ Column {
|
||||
spacing: Theme.spacingXS
|
||||
|
||||
Item {
|
||||
width: 120
|
||||
width: 60
|
||||
height: 32
|
||||
visible: modelData.id === "gpuTemp"
|
||||
|
||||
DankDropdown {
|
||||
id: gpuDropdown
|
||||
anchors.fill: parent
|
||||
popupWidth: -1
|
||||
currentValue: {
|
||||
var selectedIndex = modelData.selectedGpuIndex
|
||||
!== undefined ? modelData.selectedGpuIndex : 0
|
||||
@@ -223,12 +224,7 @@ Column {
|
||||
Item {
|
||||
width: 32
|
||||
height: 32
|
||||
visible: (modelData.warning !== undefined
|
||||
&& modelData.warning !== "")
|
||||
&& (modelData.id === "cpuUsage"
|
||||
|| modelData.id === "memUsage"
|
||||
|| modelData.id === "cpuTemp"
|
||||
|| modelData.id === "gpuTemp")
|
||||
visible: modelData.warning !== undefined && modelData.warning !== ""
|
||||
|
||||
DankIcon {
|
||||
name: "warning"
|
||||
|
||||
Reference in New Issue
Block a user