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

lock: synchronize password inputs between displays and fix video

screensave/password focus
fixes #1933
This commit is contained in:
bbedward
2026-07-04 11:28:45 -04:00
parent 7e095415a7
commit 9911698237
3 changed files with 299 additions and 285 deletions
+272 -247
View File
@@ -25,142 +25,179 @@ Rectangle {
property string strClose: "keyboard_hide"
property var modelKeyboard: {
"row_1": [{
"text": 'q',
"symbol": '1',
"width": 1
}, {
"text": 'w',
"symbol": '2',
"width": 1
}, {
"text": 'e',
"symbol": '3',
"width": 1
}, {
"text": 'r',
"symbol": '4',
"width": 1
}, {
"text": 't',
"symbol": '5',
"width": 1
}, {
"text": 'y',
"symbol": '6',
"width": 1
}, {
"text": 'u',
"symbol": '7',
"width": 1
}, {
"text": 'i',
"symbol": '8',
"width": 1
}, {
"text": 'o',
"symbol": '9',
"width": 1
}, {
"text": 'p',
"symbol": '0',
"width": 1
}],
"row_2": [{
"text": 'a',
"symbol": '-',
"width": 1
}, {
"text": 's',
"symbol": '/',
"width": 1
}, {
"text": 'd',
"symbol": ':',
"width": 1
}, {
"text": 'f',
"symbol": ';',
"width": 1
}, {
"text": 'g',
"symbol": '(',
"width": 1
}, {
"text": 'h',
"symbol": ')',
"width": 1
}, {
"text": 'j',
"symbol": '€',
"width": 1
}, {
"text": 'k',
"symbol": '&',
"width": 1
}, {
"text": 'l',
"symbol": '@',
"width": 1
}],
"row_3": [{
"text": strShift,
"symbol": strShift,
"width": 1.5
}, {
"text": 'z',
"symbol": '.',
"width": 1
}, {
"text": 'x',
"symbol": ',',
"width": 1
}, {
"text": 'c',
"symbol": '?',
"width": 1
}, {
"text": 'v',
"symbol": '!',
"width": 1
}, {
"text": 'b',
"symbol": "'",
"width": 1
}, {
"text": 'n',
"symbol": "%",
"width": 1
}, {
"text": 'm',
"symbol": '"',
"width": 1
}, {
"text": strBackspace,
"symbol": strBackspace,
"width": 1.5
}],
"row_4": [{
"text": strClose,
"symbol": strClose,
"width": 1.5
}, {
"text": "123",
"symbol": 'ABC',
"width": 1.5
}, {
"text": ' ',
"symbol": ' ',
"width": 4.5
}, {
"text": '.',
"symbol": '.',
"width": 1
}, {
"text": strEnter,
"symbol": strEnter,
"width": 1.5
}]
"row_1": [
{
"text": 'q',
"symbol": '1',
"width": 1
},
{
"text": 'w',
"symbol": '2',
"width": 1
},
{
"text": 'e',
"symbol": '3',
"width": 1
},
{
"text": 'r',
"symbol": '4',
"width": 1
},
{
"text": 't',
"symbol": '5',
"width": 1
},
{
"text": 'y',
"symbol": '6',
"width": 1
},
{
"text": 'u',
"symbol": '7',
"width": 1
},
{
"text": 'i',
"symbol": '8',
"width": 1
},
{
"text": 'o',
"symbol": '9',
"width": 1
},
{
"text": 'p',
"symbol": '0',
"width": 1
}
],
"row_2": [
{
"text": 'a',
"symbol": '-',
"width": 1
},
{
"text": 's',
"symbol": '/',
"width": 1
},
{
"text": 'd',
"symbol": ':',
"width": 1
},
{
"text": 'f',
"symbol": ';',
"width": 1
},
{
"text": 'g',
"symbol": '(',
"width": 1
},
{
"text": 'h',
"symbol": ')',
"width": 1
},
{
"text": 'j',
"symbol": '€',
"width": 1
},
{
"text": 'k',
"symbol": '&',
"width": 1
},
{
"text": 'l',
"symbol": '@',
"width": 1
}
],
"row_3": [
{
"text": strShift,
"symbol": strShift,
"width": 1.5
},
{
"text": 'z',
"symbol": '.',
"width": 1
},
{
"text": 'x',
"symbol": ',',
"width": 1
},
{
"text": 'c',
"symbol": '?',
"width": 1
},
{
"text": 'v',
"symbol": '!',
"width": 1
},
{
"text": 'b',
"symbol": "'",
"width": 1
},
{
"text": 'n',
"symbol": "%",
"width": 1
},
{
"text": 'm',
"symbol": '"',
"width": 1
},
{
"text": strBackspace,
"symbol": strBackspace,
"width": 1.5
}
],
"row_4": [
{
"text": strClose,
"symbol": strClose,
"width": 1.5
},
{
"text": "123",
"symbol": 'ABC',
"width": 1.5
},
{
"text": ' ',
"symbol": ' ',
"width": 4.5
},
{
"text": '.',
"symbol": '.',
"width": 1
},
{
"text": strEnter,
"symbol": strEnter,
"width": 1.5
}
]
}
//Here is the corresponding table between the ascii and the key event
@@ -210,9 +247,7 @@ Rectangle {
"_;": Qt.Key_Semicolon,
"_(": Qt.Key_BracketLeft,
"_)": Qt.Key_BracketRight,
"_€": parseInt(
"20ac",
16) // I didn't find the appropriate Qt event so I used the hex format
"_€": parseInt("20ac", 16) // I didn't find the appropriate Qt event so I used the hex format
,
"_&": Qt.Key_Ampersand,
"_@": Qt.Key_At,
@@ -224,121 +259,111 @@ Rectangle {
"_'": Qt.Key_Apostrophe,
"_%": Qt.Key_Percent,
"_*": Qt.Key_Asterisk
}
}
Item {
id: keyboard_container
anchors.left: parent.left
anchors.leftMargin: 5
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: 5
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
Item {
id: keyboard_container
anchors.left: parent.left
anchors.leftMargin: 5
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: 5
anchors.bottom: parent.bottom
anchors.bottomMargin: 5
//One column which contains 5 rows
Column {
spacing: columnSpacing
//One column which contains 5 rows
Column {
spacing: columnSpacing
Row {
id: row_1
spacing: rowSpacing
Repeater {
model: modelKeyboard["row_1"]
delegate: CustomButtonKeyboard {
text: symbols ? modelData.symbol : shift ? modelData.text.toUpperCase
() : modelData.text
width: modelData.width * keyboard_container.width / columns - rowSpacing
height: keyboard_container.height / rows - columnSpacing
Row {
id: row_1
spacing: rowSpacing
Repeater {
model: modelKeyboard["row_1"]
delegate: CustomButtonKeyboard {
text: symbols ? modelData.symbol : shift ? modelData.text.toUpperCase() : modelData.text
width: modelData.width * keyboard_container.width / columns - rowSpacing
height: keyboard_container.height / rows - columnSpacing
onClicked: root.clicked(text)
}
}
}
Row {
id: row_2
spacing: rowSpacing
Repeater {
model: modelKeyboard["row_2"]
delegate: CustomButtonKeyboard {
text: symbols ? modelData.symbol : shift ? modelData.text.toUpperCase
() : modelData.text
width: modelData.width * keyboard_container.width / columns - rowSpacing
height: keyboard_container.height / rows - columnSpacing
onClicked: root.clicked(text)
}
}
}
Row {
id: row_2
spacing: rowSpacing
Repeater {
model: modelKeyboard["row_2"]
delegate: CustomButtonKeyboard {
text: symbols ? modelData.symbol : shift ? modelData.text.toUpperCase() : modelData.text
width: modelData.width * keyboard_container.width / columns - rowSpacing
height: keyboard_container.height / rows - columnSpacing
onClicked: root.clicked(text)
}
}
}
Row {
id: row_3
spacing: rowSpacing
Repeater {
model: modelKeyboard["row_3"]
delegate: CustomButtonKeyboard {
text: symbols ? modelData.symbol : shift ? modelData.text.toUpperCase
() : modelData.text
width: modelData.width * keyboard_container.width / columns - rowSpacing
height: keyboard_container.height / rows - columnSpacing
isShift: shift && text === strShift
onClicked: root.clicked(text)
}
}
}
Row {
id: row_3
spacing: rowSpacing
Repeater {
model: modelKeyboard["row_3"]
delegate: CustomButtonKeyboard {
text: symbols ? modelData.symbol : shift ? modelData.text.toUpperCase() : modelData.text
width: modelData.width * keyboard_container.width / columns - rowSpacing
height: keyboard_container.height / rows - columnSpacing
isShift: shift && text === strShift
onClicked: root.clicked(text)
}
}
}
Row {
id: row_4
spacing: rowSpacing
Repeater {
model: modelKeyboard["row_4"]
delegate: CustomButtonKeyboard {
text: symbols ? modelData.symbol : shift ? modelData.text.toUpperCase
() : modelData.text
width: modelData.width * keyboard_container.width / columns - rowSpacing
height: keyboard_container.height / rows - columnSpacing
onClicked: root.clicked(text)
}
}
}
Row {
id: row_4
spacing: rowSpacing
Repeater {
model: modelKeyboard["row_4"]
delegate: CustomButtonKeyboard {
text: symbols ? modelData.symbol : shift ? modelData.text.toUpperCase() : modelData.text
width: modelData.width * keyboard_container.width / columns - rowSpacing
height: keyboard_container.height / rows - columnSpacing
onClicked: root.clicked(text)
}
}
}
}
}
signal clicked(string text)
onClicked: root.clicked(text)
}
}
}
}
}
signal clicked(string text)
Connections {
target: root
function onClicked(text) {
if (!keyboard_controller.target)
return
if (text === strShift) {
root.shift = !root.shift
} else if (text === '123') {
root.symbols = true
} else if (text === 'ABC') {
root.symbols = false
} else if (text === strEnter) {
if (keyboard_controller.target.accepted) {
keyboard_controller.target.accepted()
}
} else if (text === strClose) {
root.dismissed()
} else {
if (text === strBackspace) {
var current = keyboard_controller.target.text
keyboard_controller.target.text = current.slice(0, current.length - 1)
} else {
var charToInsert = root.symbols ? text : (root.shift ? text.toUpperCase
() : text)
var current = keyboard_controller.target.text
var cursorPos = keyboard_controller.target.cursorPosition
keyboard_controller.target.text = current.slice(0,
cursorPos) + charToInsert + current.slice(cursorPos)
keyboard_controller.target.cursorPosition = cursorPos + 1
}
Connections {
target: root
function onClicked(text) {
if (!keyboard_controller.target)
return;
if (text === strShift) {
root.shift = !root.shift;
} else if (text === '123') {
root.symbols = true;
} else if (text === 'ABC') {
root.symbols = false;
} else if (text === strEnter) {
if (keyboard_controller.target.accepted) {
keyboard_controller.target.accepted();
}
} else if (text === strClose) {
root.dismissed();
} else {
if (text === strBackspace) {
keyboard_controller.target.backspace();
} else {
var charToInsert = root.symbols ? text : (root.shift ? text.toUpperCase() : text);
keyboard_controller.target.insertText(charToInsert);
}
if (root.shift && text !== strShift)
root.shift = false
}
}
}
if (root.shift && text !== strShift)
root.shift = false;
}
}
}
}