1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-16 17:22:45 -04:00

text: change default rendering back to Qt

This commit is contained in:
bbedward
2026-05-15 09:45:10 -04:00
parent 0a892a4a9e
commit 1c1ab1c7d5
50 changed files with 520 additions and 496 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ DankModal {
confirmButtonText = "Confirm";
cancelButtonText = "Cancel";
confirmButtonColor = Theme.primary;
onConfirm = onConfirmCallback || ((text) => {});
onConfirm = onConfirmCallback || (text => {});
onCancel = onCancelCallback || (() => {});
selectedButton = -1;
keyboardNavigation = false;
@@ -44,7 +44,7 @@ DankModal {
confirmButtonText = options.confirmText || "Confirm";
cancelButtonText = options.cancelText || "Cancel";
confirmButtonColor = options.confirmColor || Theme.primary;
onConfirm = options.onConfirm || ((text) => {});
onConfirm = options.onConfirm || (text => {});
onCancel = options.onCancel || (() => {});
selectedButton = -1;
keyboardNavigation = false;
@@ -70,7 +70,7 @@ Rectangle {
materialIconSizeAdjustment: root.computedIconSize * 0.3
}
Text {
StyledText {
width: parent.width
text: root.item?._hName ?? root.item?.name ?? ""
textFormat: root.item?._hRich ? Text.RichText : Text.PlainText
@@ -95,7 +95,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
height: nameText.implicitHeight + (subText.visible ? subText.height + 2 : 0)
Text {
StyledText {
id: nameText
anchors.left: parent.left
anchors.right: parent.right
@@ -128,7 +128,7 @@ Rectangle {
return e.endsWith("…") ? e.length - 1 : e.length;
}
Text {
StyledText {
id: subText
anchors.left: parent.left
anchors.right: parent.right
@@ -72,7 +72,9 @@ Rectangle {
readonly property var iconMap: {
const cats = root.controller?.appCategories ?? [];
const m = {};
cats.forEach(c => { m[c] = AppSearchService.getCategoryIcon(c); });
cats.forEach(c => {
m[c] = AppSearchService.getCategoryIcon(c);
});
return m;
}
@@ -137,7 +139,9 @@ Rectangle {
dim: false
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
background: Rectangle { color: "transparent" }
background: Rectangle {
color: "transparent"
}
contentItem: Rectangle {
radius: Theme.cornerRadius
@@ -114,7 +114,7 @@ Rectangle {
color: Theme.withAlpha(Theme.surfaceContainer, 0.85)
visible: root.item?.name?.length > 0
Text {
StyledText {
id: labelText
anchors.fill: parent
anchors.margins: Theme.spacingXS
@@ -13,7 +13,7 @@ Row {
property bool pathEditMode: false
property bool pathInputHasFocus: false
signal navigateUp()
signal navigateUp
signal navigateTo(string path)
signal pathInputFocusChanged(bool hasFocus)
@@ -80,9 +80,9 @@ Row {
anchors.fill: parent
cursorShape: Qt.IBeamCursor
onClicked: {
pathEditMode = true
pathInput.text = currentPath.replace("file://", "")
Qt.callLater(() => pathInput.forceActiveFocus())
pathEditMode = true;
pathInput.text = currentPath.replace("file://", "");
Qt.callLater(() => pathInput.forceActiveFocus());
}
}
}
@@ -94,22 +94,22 @@ Row {
topPadding: Theme.spacingXS
bottomPadding: Theme.spacingXS
onAccepted: {
const newPath = text.trim()
const newPath = text.trim();
if (newPath !== "") {
navigation.navigateTo(newPath)
navigation.navigateTo(newPath);
}
pathEditMode = false
pathEditMode = false;
}
Keys.onEscapePressed: {
pathEditMode = false
pathEditMode = false;
}
Keys.onDownPressed: {
pathEditMode = false
pathEditMode = false;
}
onActiveFocusChanged: {
navigation.pathInputFocusChanged(activeFocus)
navigation.pathInputFocusChanged(activeFocus);
if (!activeFocus && pathEditMode) {
pathEditMode = false
pathEditMode = false;
}
}
}
@@ -9,17 +9,17 @@ Item {
property string pendingFilePath: ""
signal confirmed(string filePath)
signal cancelled()
signal cancelled
visible: showDialog
focus: showDialog
Keys.onEscapePressed: {
cancelled()
cancelled();
}
Keys.onReturnPressed: {
confirmed(pendingFilePath)
confirmed(pendingFilePath);
}
Rectangle {
@@ -30,7 +30,7 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
cancelled()
cancelled();
}
}
}
@@ -92,7 +92,7 @@ Item {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
cancelled()
cancelled();
}
}
}
@@ -117,7 +117,7 @@ Item {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
confirmed(pendingFilePath)
confirmed(pendingFilePath);
}
}
}
@@ -29,15 +29,15 @@ Row {
Component.onCompleted: {
if (saveMode)
Qt.callLater(() => {
forceActiveFocus()
})
forceActiveFocus();
});
}
onAccepted: {
if (text.trim() !== "") {
var basePath = currentPath.replace(/^file:\/\//, '')
var fullPath = basePath + "/" + text.trim()
fullPath = fullPath.replace(/\/+/g, '/')
saveRequested(fullPath)
var basePath = currentPath.replace(/^file:\/\//, '');
var fullPath = basePath + "/" + text.trim();
fullPath = fullPath.replace(/\/+/g, '/');
saveRequested(fullPath);
}
}
}
@@ -63,10 +63,10 @@ Row {
enabled: fileNameInput.text.trim() !== ""
onClicked: {
if (fileNameInput.text.trim() !== "") {
var basePath = currentPath.replace(/^file:\/\//, '')
var fullPath = basePath + "/" + fileNameInput.text.trim()
fullPath = fullPath.replace(/\/+/g, '/')
saveRequested(fullPath)
var basePath = currentPath.replace(/^file:\/\//, '');
var fullPath = basePath + "/" + fileNameInput.text.trim();
fullPath = fullPath.replace(/\/+/g, '/');
saveRequested(fullPath);
}
}
}
@@ -36,19 +36,24 @@ StyledRect {
}
Repeater {
model: [{
model: [
{
"name": "Name",
"value": "name"
}, {
},
{
"name": "Size",
"value": "size"
}, {
},
{
"name": "Modified",
"value": "modified"
}, {
},
{
"name": "Type",
"value": "type"
}]
}
]
StyledRect {
width: sortColumn?.width ?? 0
@@ -83,8 +88,8 @@ StyledRect {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
sortMenu.sortBySelected(modelData?.value ?? "name")
sortMenu.visible = false
sortMenu.sortBySelected(modelData?.value ?? "name");
sortMenu.visible = false;
}
}
}
@@ -136,8 +141,8 @@ StyledRect {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
sortMenu.sortOrderSelected(true)
sortMenu.visible = false
sortMenu.sortOrderSelected(true);
sortMenu.visible = false;
}
}
}
@@ -174,8 +179,8 @@ StyledRect {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
sortMenu.sortOrderSelected(false)
sortMenu.visible = false
sortMenu.sortOrderSelected(false);
sortMenu.visible = false;
}
}
}
+3 -9
View File
@@ -142,13 +142,7 @@ DankModal {
let shouldContinue = false;
for (let j = 0; j < lowerQueryWords.length; j++) {
const word = lowerQueryWords[j];
if (!(
word.length === 0 ||
keyLower.includes(word) ||
descLower.includes(word) ||
catLower.includes(word) ||
actionLower.includes(word)
)) {
if (!(word.length === 0 || keyLower.includes(word) || descLower.includes(word) || catLower.includes(word) || actionLower.includes(word))) {
shouldContinue = true;
break;
}
@@ -181,7 +175,7 @@ DankModal {
return processed;
}
property var categories: generateCategories("");
property var categories: generateCategories("")
function estimateCategoryHeight(catName) {
const catData = categories[catName];
@@ -196,7 +190,7 @@ DankModal {
return 40 + bindCount * 28;
}
property var categoryKeys: Object.keys(categories);
property var categoryKeys: Object.keys(categories)
function distributeCategories(cols) {
const columns = [];
+97 -89
View File
@@ -21,18 +21,18 @@ DankModal {
property var filteredSessions: []
function updateFilteredSessions() {
var filtered = []
var lowerSearch = searchText.trim().toLowerCase()
var filtered = [];
var lowerSearch = searchText.trim().toLowerCase();
for (var i = 0; i < MuxService.sessions.length; i++) {
var session = MuxService.sessions[i]
var session = MuxService.sessions[i];
if (lowerSearch.length > 0 && !session.name.toLowerCase().includes(lowerSearch))
continue
filtered.push(session)
continue;
filtered.push(session);
}
filteredSessions = filtered
filteredSessions = filtered;
if (selectedIndex >= filteredSessions.length) {
selectedIndex = Math.max(0, filteredSessions.length - 1)
selectedIndex = Math.max(0, filteredSessions.length - 1);
}
}
@@ -41,7 +41,7 @@ DankModal {
Connections {
target: MuxService
function onSessionsChanged() {
updateFilteredSessions()
updateFilteredSessions();
}
}
@@ -53,35 +53,35 @@ DankModal {
function toggle() {
if (shouldBeVisible) {
hide()
hide();
} else {
show()
show();
}
}
function show() {
open()
selectedIndex = -1
searchText = ""
MuxService.refreshSessions()
shouldHaveFocus = true
open();
selectedIndex = -1;
searchText = "";
MuxService.refreshSessions();
shouldHaveFocus = true;
Qt.callLater(() => {
if (muxPanel && muxPanel.searchField) {
muxPanel.searchField.forceActiveFocus();
}
})
});
}
function hide() {
close()
selectedIndex = -1
searchText = ""
close();
selectedIndex = -1;
searchText = "";
}
function attachToSession(name) {
MuxService.attachToSession(name)
hide()
MuxService.attachToSession(name);
hide();
}
function renameSession(name) {
@@ -90,9 +90,9 @@ DankModal {
message: I18n.tr("Enter a new name for session \"%1\"").arg(name),
initialText: name,
onConfirm: function (newName) {
MuxService.renameSession(name, newName)
MuxService.renameSession(name, newName);
}
})
});
}
function killSession(name) {
@@ -102,9 +102,9 @@ DankModal {
confirmText: I18n.tr("Kill"),
confirmColor: Theme.primary,
onConfirm: function () {
MuxService.killSession(name)
MuxService.killSession(name);
}
})
});
}
function createNewSession() {
@@ -112,25 +112,25 @@ DankModal {
title: I18n.tr("New Session"),
message: I18n.tr("Please write a name for your new %1 session").arg(MuxService.displayName),
onConfirm: function (name) {
MuxService.createSession(name)
hide()
MuxService.createSession(name);
hide();
}
})
});
}
function selectNext() {
selectedIndex = Math.min(selectedIndex + 1, filteredSessions.length - 1)
selectedIndex = Math.min(selectedIndex + 1, filteredSessions.length - 1);
}
function selectPrevious() {
selectedIndex = Math.max(selectedIndex - 1, -1)
selectedIndex = Math.max(selectedIndex - 1, -1);
}
function activateSelected() {
if (selectedIndex === -1) {
createNewSession()
createNewSession();
} else if (selectedIndex >= 0 && selectedIndex < filteredSessions.length) {
attachToSession(filteredSessions[selectedIndex].name)
attachToSession(filteredSessions[selectedIndex].name);
}
}
@@ -155,18 +155,18 @@ DankModal {
IpcHandler {
function open(): string {
muxModal.show()
return "MUX_OPEN_SUCCESS"
muxModal.show();
return "MUX_OPEN_SUCCESS";
}
function close(): string {
muxModal.hide()
return "MUX_CLOSE_SUCCESS"
muxModal.hide();
return "MUX_CLOSE_SUCCESS";
}
function toggle(): string {
muxModal.toggle()
return "MUX_TOGGLE_SUCCESS"
muxModal.toggle();
return "MUX_TOGGLE_SUCCESS";
}
target: "mux"
@@ -175,18 +175,18 @@ DankModal {
// Backwards compatibility
IpcHandler {
function open(): string {
muxModal.show()
return "TMUX_OPEN_SUCCESS"
muxModal.show();
return "TMUX_OPEN_SUCCESS";
}
function close(): string {
muxModal.hide()
return "TMUX_CLOSE_SUCCESS"
muxModal.hide();
return "TMUX_CLOSE_SUCCESS";
}
function toggle(): string {
muxModal.toggle()
return "TMUX_TOGGLE_SUCCESS"
muxModal.toggle();
return "TMUX_TOGGLE_SUCCESS";
}
target: "tmux"
@@ -248,33 +248,31 @@ DankModal {
property alias searchField: searchField
Keys.onPressed: event => {
if ((event.key === Qt.Key_J && (event.modifiers & Qt.ControlModifier)) ||
(event.key === Qt.Key_Down)) {
selectNext()
event.accepted = true
} else if ((event.key === Qt.Key_K && (event.modifiers & Qt.ControlModifier)) ||
(event.key === Qt.Key_Up)) {
selectPrevious()
event.accepted = true
if ((event.key === Qt.Key_J && (event.modifiers & Qt.ControlModifier)) || (event.key === Qt.Key_Down)) {
selectNext();
event.accepted = true;
} else if ((event.key === Qt.Key_K && (event.modifiers & Qt.ControlModifier)) || (event.key === Qt.Key_Up)) {
selectPrevious();
event.accepted = true;
} else if (event.key === Qt.Key_N && (event.modifiers & Qt.ControlModifier)) {
createNewSession()
event.accepted = true
createNewSession();
event.accepted = true;
} else if (event.key === Qt.Key_R && (event.modifiers & Qt.ControlModifier)) {
if (MuxService.supportsRename && selectedIndex >= 0 && selectedIndex < filteredSessions.length) {
renameSession(filteredSessions[selectedIndex].name)
renameSession(filteredSessions[selectedIndex].name);
}
event.accepted = true
event.accepted = true;
} else if (event.key === Qt.Key_D && (event.modifiers & Qt.ControlModifier)) {
if (selectedIndex >= 0 && selectedIndex < filteredSessions.length) {
killSession(filteredSessions[selectedIndex].name)
killSession(filteredSessions[selectedIndex].name);
}
event.accepted = true
event.accepted = true;
} else if (event.key === Qt.Key_Escape) {
hide()
event.accepted = true
hide();
event.accepted = true;
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
activateSelected()
event.accepted = true
activateSelected();
event.accepted = true;
}
}
@@ -307,12 +305,8 @@ DankModal {
text: {
const total = MuxService.sessions.length;
const filtered = muxModal.filteredSessions.length;
const activePart = total === 1
? I18n.tr("%1 active session").arg(total)
: I18n.tr("%1 active sessions").arg(total);
const filteredPart = filtered === 1
? I18n.tr("%1 filtered").arg(filtered)
: I18n.tr("%1 filtered").arg(filtered);
const activePart = total === 1 ? I18n.tr("%1 active session").arg(total) : I18n.tr("%1 active sessions").arg(total);
const filteredPart = filtered === 1 ? I18n.tr("%1 filtered").arg(filtered) : I18n.tr("%1 filtered").arg(filtered);
return activePart + ", " + filteredPart;
}
font.pixelSize: Theme.fontSizeMedium
@@ -340,8 +334,8 @@ DankModal {
keyForwardTargets: [muxPanel]
onTextEdited: {
muxModal.searchText = text
muxModal.selectedIndex = 0
muxModal.searchText = text;
muxModal.selectedIndex = 0;
}
}
@@ -350,8 +344,7 @@ DankModal {
width: parent.width
height: 56
radius: Theme.cornerRadius
color: muxModal.selectedIndex === -1 ? Theme.primaryContainer :
(newMouse.containsMouse ? Theme.surfaceContainerHigh : Theme.surfaceContainer)
color: muxModal.selectedIndex === -1 ? Theme.primaryContainer : (newMouse.containsMouse ? Theme.surfaceContainerHigh : Theme.surfaceContainer)
RowLayout {
anchors.fill: parent
@@ -428,8 +421,7 @@ DankModal {
width: parent.width
height: 64
radius: Theme.cornerRadius
color: muxModal.selectedIndex === index ? Theme.primaryContainer :
(sessionMouse.containsMouse ? Theme.surfaceContainerHigh : "transparent")
color: muxModal.selectedIndex === index ? Theme.primaryContainer : (sessionMouse.containsMouse ? Theme.surfaceContainerHigh : "transparent")
MouseArea {
id: sessionMouse
@@ -476,13 +468,11 @@ DankModal {
StyledText {
text: {
var parts = []
var parts = [];
if (modelData.windows !== "N/A")
parts.push(modelData.windows === 1
? I18n.tr("%1 window").arg(modelData.windows)
: I18n.tr("%1 windows").arg(modelData.windows))
parts.push(modelData.attached ? I18n.tr("attached") : I18n.tr("detached"))
return parts.join(" \u2022 ")
parts.push(modelData.windows === 1 ? I18n.tr("%1 window").arg(modelData.windows) : I18n.tr("%1 windows").arg(modelData.windows));
parts.push(modelData.attached ? I18n.tr("attached") : I18n.tr("detached"));
return parts.join(" \u2022 ");
}
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
@@ -533,7 +523,7 @@ DankModal {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
muxModal.killSession(modelData.name)
muxModal.killSession(modelData.name);
}
}
}
@@ -587,15 +577,33 @@ DankModal {
Repeater {
model: {
var shortcuts = [
{ key: "↑↓", label: I18n.tr("Navigate") },
{ key: "↵", label: I18n.tr("Attach") },
{ key: "^N", label: I18n.tr("New") },
{ key: "^D", label: I18n.tr("Kill") },
{ key: "Esc", label: I18n.tr("Close") }
]
{
key: "↑↓",
label: I18n.tr("Navigate")
},
{
key: "↵",
label: I18n.tr("Attach")
},
{
key: "^N",
label: I18n.tr("New")
},
{
key: "^D",
label: I18n.tr("Kill")
},
{
key: "Esc",
label: I18n.tr("Close")
}
];
if (MuxService.supportsRename)
shortcuts.splice(3, 0, { key: "^R", label: I18n.tr("Rename") })
return shortcuts
shortcuts.splice(3, 0, {
key: "^R",
label: I18n.tr("Rename")
});
return shortcuts;
}
delegate: Row {
+2 -2
View File
@@ -68,7 +68,7 @@ DankModal {
if (response.error) {
ToastService.showError(I18n.tr("Failed to remove QR code at %1: %2").arg(path).arg(JSON.stringify(response.error)));
}
})
});
}
LazyLoader {
@@ -90,7 +90,7 @@ DankModal {
const fileName = cleanPath.split('/').pop();
const fileUrl = "file://" + cleanPath;
copyQrCodeProcess.exec(["cp", root.normalQrCodePath, cleanPath, "-f"])
copyQrCodeProcess.exec(["cp", root.normalQrCodePath, cleanPath, "-f"]);
}
Process {