1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-03 12:08:31 -04:00

qs: large sweep of dead code removals

This commit is contained in:
bbedward
2026-07-26 23:22:22 -04:00
parent bab2078dfd
commit c67b185076
113 changed files with 1467 additions and 3254 deletions
@@ -387,7 +387,6 @@ Singleton {
});
}
// Extract neutral per-output config from current live state
function extractOutputNeutralConfig(outputName, outputData, niriSettings, hyprlandSettings) {
const modeData = (outputData.modes && outputData.current_mode !== undefined) ? outputData.modes[outputData.current_mode] : null;
const modeStr = modeData ? modeData.width + "x" + modeData.height + "@" + (modeData.refresh_rate / 1000).toFixed(3) : null;
@@ -421,7 +420,6 @@ Singleton {
return cfg;
}
// Convert monitors.json config entry → internal outputsData map
function profileKeyMatchesOutput(outputId, output, name) {
if (name === outputId || getOutputIdentifier(output, name) === outputId)
return true;
@@ -438,7 +436,6 @@ Singleton {
const cfgOutputs = configEntry.outputs || {};
for (const outputId in cfgOutputs) {
const cfg = cfgOutputs[outputId];
// Find matching live output to get modes list
let liveOutput = null;
for (const name in outputs) {
if (profileKeyMatchesOutput(outputId, outputs[name], name)) {
@@ -476,7 +473,6 @@ Singleton {
return result;
}
// Extract niri settings map from a neutral config entry.
function getNiriSettingsFromConfig(configEntry) {
const result = {};
for (const outputId in (configEntry.outputs || {})) {
@@ -490,7 +486,6 @@ Singleton {
return result;
}
// Extract hyprland settings map from neutral config entry
function getHyprlandSettingsFromConfig(configEntry) {
const result = {};
for (const outputId in (configEntry.outputs || {})) {
@@ -537,7 +532,6 @@ Singleton {
return true;
}
// Write compositor config from a neutral config entry and optionally reload
function applyConfigEntry(configEntry, configId, profileName, isManual) {
if (CompositorService.isHyprland && readOnly) {
if (isManual) {
@@ -580,8 +574,6 @@ Singleton {
});
}
// ── Profile management ─────────────────────────────────────────────────
function validateProfiles() {
log.info("Validating profiles against current outputs...");
readMonitorsJson(data => {
@@ -2072,7 +2064,6 @@ Singleton {
return pending !== undefined ? pending : originalValue;
}
// Returns true if the given output can currently be disabled.
// Prevents disabling all outputs and prevents disabling the only output
// in a single-display configuration.
function canDisableOutput() {
@@ -3,23 +3,11 @@ import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets
import "../../Common/Format.js" as Format
Item {
id: root
function formatGammaTime(isoString) {
if (!isoString)
return "";
try {
const date = new Date(isoString);
if (isNaN(date.getTime()))
return "";
return date.toLocaleTimeString(Qt.locale(), "HH:mm");
} catch (e) {
return "";
}
}
DankFlickable {
anchors.fill: parent
clip: true
@@ -195,7 +183,7 @@ Item {
}
onTabClicked: index => {
DisplayService.setNightModeAutomationMode(index === 1 ? "location" : "time");
SessionData.setNightModeAutoMode(index === 1 ? "location" : "time");
currentIndex = index;
}
@@ -562,7 +550,7 @@ Item {
}
StyledText {
text: root.formatGammaTime(DisplayService.gammaSunriseTime)
text: Format.formatIsoTime(DisplayService.gammaSunriseTime)
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
@@ -598,7 +586,7 @@ Item {
}
StyledText {
text: root.formatGammaTime(DisplayService.gammaSunsetTime)
text: Format.formatIsoTime(DisplayService.gammaSunsetTime)
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
@@ -645,7 +633,7 @@ Item {
}
StyledText {
text: root.formatGammaTime(DisplayService.gammaNextTransition)
text: Format.formatIsoTime(DisplayService.gammaNextTransition)
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
File diff suppressed because it is too large Load Diff
@@ -240,7 +240,7 @@ Item {
required property var modelData
required property int index
readonly property bool isActive: DMSNetworkService.isActiveUuid(modelData.uuid)
readonly property bool isActive: DMSNetworkService.isActiveVpnUuid(modelData.uuid)
readonly property bool isTransient: !!modelData.transient
readonly property bool canExpand: modelData.canExpand !== false
readonly property bool canDelete: modelData.canDelete !== false
+3 -10
View File
@@ -9,6 +9,7 @@ import qs.Modules.Settings.Widgets
import qs.Modals.Common
import qs.Services
import qs.Widgets
import "../../Common/QmlUtils.js" as QmlUtils
Item {
id: networkWifiTab
@@ -46,22 +47,14 @@ Item {
property string expandedSavedWifiSsid: ""
property int maxPinnedWifiNetworks: 3
function normalizePinList(value) {
if (Array.isArray(value))
return value.filter(v => v);
if (typeof value === "string" && value.length > 0)
return [value];
return [];
}
function getPinnedWifiNetworks() {
const pins = CacheData.wifiNetworkPins || {};
return normalizePinList(pins["preferredWifi"]);
return QmlUtils.normalizePinList(pins["preferredWifi"]);
}
function toggleWifiPin(ssid) {
const pins = JSON.parse(JSON.stringify(CacheData.wifiNetworkPins || {}));
let pinnedList = normalizePinList(pins["preferredWifi"]);
let pinnedList = QmlUtils.normalizePinList(pins["preferredWifi"]);
const pinIndex = pinnedList.indexOf(ssid);
if (pinIndex !== -1) {
@@ -1,5 +1,6 @@
import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets
@@ -215,7 +216,7 @@ Item {
currentValue: (SettingsData.notificationSummaryFontSize || I18n.tr("Unset")).toString()
onValueChanged: value => {
SettingsData.set("notificationSummaryFontSize", Number(value === I18n.tr("Unset") ? 0 : value));
SettingsData.sendTestNotifications();
NotificationService.sendTestNotifications();
}
}
@@ -228,7 +229,7 @@ Item {
currentValue: (SettingsData.notificationBodyFontSize || I18n.tr("Unset")).toString()
onValueChanged: value => {
SettingsData.set("notificationBodyFontSize", Number(value === I18n.tr("Unset") ? 0 : value));
SettingsData.sendTestNotifications();
NotificationService.sendTestNotifications();
}
}
@@ -277,7 +278,7 @@ Item {
SettingsData.set("notificationPopupPosition", SettingsData.Position.Bottom);
break;
}
SettingsData.sendTestNotifications();
NotificationService.sendTestNotifications();
}
}
+2 -14
View File
@@ -8,6 +8,7 @@ import qs.Services
import qs.Widgets
import qs.Modules.Settings.Widgets
import "../../Common/ConfigIncludeResolve.js" as ConfigIncludeResolve
import "../../Common/Format.js" as Format
Item {
id: themeColorsTab
@@ -215,19 +216,6 @@ Item {
ToastService.showError(I18n.tr("Missing Environment Variables", "qt theme env error title"), I18n.tr("You need to set either:\nQT_QPA_PLATFORMTHEME=gtk3 OR\nQT_QPA_PLATFORMTHEME=qt6ct\nas environment variables, and then restart the shell.\n\nqt6ct requires qt6ct-kde to be installed.", "qt theme env error body"));
}
function formatThemeAutoTime(isoString) {
if (!isoString)
return "";
try {
const date = new Date(isoString);
if (isNaN(date.getTime()))
return "";
return date.toLocaleTimeString(Qt.locale(), "HH:mm");
} catch (e) {
return "";
}
}
function refreshMatugenSchemePreviews() {
if (!Theme.matugenAvailable)
return;
@@ -1566,7 +1554,7 @@ Item {
}
StyledText {
text: themeColorsTab.formatThemeAutoTime(SessionData.themeModeNextTransition)
text: Format.formatIsoTime(SessionData.themeModeNextTransition)
font.pixelSize: Theme.fontSizeMedium
font.weight: Font.Medium
color: Theme.surfaceText
@@ -4,6 +4,7 @@ import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import "../../../Common/QmlUtils.js" as QmlUtils
Item {
id: root
@@ -20,16 +21,6 @@ Item {
readonly property bool isHighlighted: settingKey !== "" && SettingsSearchService.highlightSection === settingKey
function findParentFlickable() {
let p = root.parent;
while (p) {
if (p.hasOwnProperty("contentY") && p.hasOwnProperty("contentItem"))
return p;
p = p.parent;
}
return null;
}
Component.onCompleted: {
if (!settingKey)
return;
@@ -37,7 +28,7 @@ Item {
Qt.callLater(() => {
if (!root.parent)
return;
var flickable = findParentFlickable();
var flickable = QmlUtils.findParentFlickable(root.parent);
if (flickable)
SettingsSearchService.registerCard(key, root, flickable);
});
@@ -4,6 +4,7 @@ import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import "../../../Common/QmlUtils.js" as QmlUtils
StyledRect {
id: root
@@ -43,17 +44,6 @@ StyledRect {
readonly property bool hasHeader: root.title !== "" || root.iconName !== ""
property bool userToggledCollapse: false
function findParentFlickable() {
let p = root.parent;
while (p) {
if (p.hasOwnProperty("contentY") && p.hasOwnProperty("contentItem")) {
return p;
}
p = p.parent;
}
return null;
}
Component.onCompleted: {
if (!settingKey)
return;
@@ -61,7 +51,7 @@ StyledRect {
Qt.callLater(() => {
if (!root.parent)
return;
var flickable = findParentFlickable();
var flickable = QmlUtils.findParentFlickable(root.parent);
if (flickable)
SettingsSearchService.registerCard(key, root, flickable);
});
@@ -4,6 +4,7 @@ import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import "../../../Common/QmlUtils.js" as QmlUtils
DankDropdown {
id: root
@@ -35,16 +36,6 @@ DankDropdown {
}
}
function findParentFlickable() {
let p = root.parent;
while (p) {
if (p.hasOwnProperty("contentY") && p.hasOwnProperty("contentItem"))
return p;
p = p.parent;
}
return null;
}
Component.onCompleted: {
if (!settingKey)
return;
@@ -52,7 +43,7 @@ DankDropdown {
Qt.callLater(() => {
if (!root.parent)
return;
var flickable = findParentFlickable();
var flickable = QmlUtils.findParentFlickable(root.parent);
if (flickable)
SettingsSearchService.registerCard(key, root, flickable);
});
@@ -4,6 +4,7 @@ import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import "../../../Common/QmlUtils.js" as QmlUtils
StyledRect {
id: root
@@ -36,16 +37,6 @@ StyledRect {
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
function findParentFlickable() {
let p = root.parent;
while (p) {
if (p.hasOwnProperty("contentY") && p.hasOwnProperty("contentItem"))
return p;
p = p.parent;
}
return null;
}
Component.onCompleted: {
if (!settingKey)
return;
@@ -53,7 +44,7 @@ StyledRect {
Qt.callLater(() => {
if (!root.parent)
return;
const flickable = findParentFlickable();
const flickable = QmlUtils.findParentFlickable(root.parent);
if (flickable)
SettingsSearchService.registerCard(key, root, flickable);
});
@@ -4,6 +4,7 @@ import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import "../../../Common/QmlUtils.js" as QmlUtils
Item {
id: root
@@ -20,16 +21,6 @@ Item {
readonly property bool isHighlighted: settingKey !== "" && SettingsSearchService.highlightSection === settingKey
function findParentFlickable() {
let p = root.parent;
while (p) {
if (p.hasOwnProperty("contentY") && p.hasOwnProperty("contentItem"))
return p;
p = p.parent;
}
return null;
}
Component.onCompleted: {
if (!settingKey)
return;
@@ -37,7 +28,7 @@ Item {
Qt.callLater(() => {
if (!root.parent)
return;
var flickable = findParentFlickable();
var flickable = QmlUtils.findParentFlickable(root.parent);
if (flickable)
SettingsSearchService.registerCard(key, root, flickable);
});
@@ -4,6 +4,7 @@ import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import "../../../Common/QmlUtils.js" as QmlUtils
StyledRect {
id: root
@@ -30,16 +31,6 @@ StyledRect {
radius: Theme.cornerRadius
color: Theme.surfaceContainerHigh
function findParentFlickable() {
let p = root.parent;
while (p) {
if (p.hasOwnProperty("contentY") && p.hasOwnProperty("contentItem"))
return p;
p = p.parent;
}
return null;
}
Component.onCompleted: {
if (!settingKey)
return;
@@ -47,7 +38,7 @@ StyledRect {
Qt.callLater(() => {
if (!root.parent)
return;
const flickable = findParentFlickable();
const flickable = QmlUtils.findParentFlickable(root.parent);
if (flickable)
SettingsSearchService.registerCard(key, root, flickable);
});
@@ -4,6 +4,7 @@ import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
import "../../../Common/QmlUtils.js" as QmlUtils
DankToggle {
id: root
@@ -19,16 +20,6 @@ DankToggle {
width: parent?.width ?? 0
function findParentFlickable() {
let p = root.parent;
while (p) {
if (p.hasOwnProperty("contentY") && p.hasOwnProperty("contentItem"))
return p;
p = p.parent;
}
return null;
}
Component.onCompleted: {
if (!settingKey)
return;
@@ -36,7 +27,7 @@ DankToggle {
Qt.callLater(() => {
if (!root.parent)
return;
var flickable = findParentFlickable();
var flickable = QmlUtils.findParentFlickable(root.parent);
if (flickable)
SettingsSearchService.registerCard(key, root, flickable);
});
@@ -207,7 +207,7 @@ Item {
iconName: "label"
title: I18n.tr("Named Workspace Icons")
settingKey: "workspaceIcons"
visible: SettingsData.hasNamedWorkspaces()
visible: NiriService.hasNamedWorkspaces()
StyledText {
width: parent.width
@@ -218,7 +218,7 @@ Item {
}
Repeater {
model: SettingsData.getNamedWorkspaces()
model: NiriService.getNamedWorkspaces()
Rectangle {
width: parent.width