Added Settings.

Erase messages.
Toggle external window.

Signed-off-by: Armored Dragon <publicmail@armoreddragon.com>
This commit is contained in:
Armored Dragon 2024-05-18 13:46:06 -05:00
parent 002fdf0b42
commit 0d5eb93241
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B
2 changed files with 84 additions and 4 deletions

View file

@ -129,12 +129,33 @@
}
function fromQML(event) {
console.log(`New web event:\n${JSON.stringify(event)}`);
console.log(`New QML event:\n${JSON.stringify(event)}`);
switch (event.type) {
case "send_message":
_sendMessage(event.message, event.channel);
break;
case "setting_change":
settings[event.setting] = event.value; // Update local settings
_saveSettings(); // Save local settings
switch (event.setting) {
case "external_window":
chat_overlay_window.presentationMode = event.value
? Desktop.PresentationMode.NATIVE
: Desktop.PresentationMode.VIRTUAL;
break;
}
break;
case "action":
switch (event.action) {
case "erase_history":
Settings.setValue("ArmoredChat-Messages", []);
break;
}
break;
case "initialized":
// https://github.com/overte-org/overte/issues/824
chat_overlay_window.visible = app_is_visible; // The "visible" field in the Desktop.createWindow does not seem to work. Force set it to the initial state (false)

View file

@ -26,9 +26,8 @@ Rectangle {
// toScript({type: "initialized"})
// }
Column {
Item {
anchors.fill: parent
spacing: 0
// Navigation Bar
Rectangle {
@ -135,6 +134,7 @@ Rectangle {
width: parent.width
height: parent.height - 40
anchors.top: navigation_bar.bottom
visible: ["local", "domain"].includes(pageVal) ? true : false
// Chat Message History
@ -180,7 +180,6 @@ Rectangle {
height: 40
color: Qt.rgba(0.9,0.9,0.9,1)
anchors.bottom: parent.bottom
visible: ["local", "domain"].includes(pageVal) ? true : false
Row {
width: parent.width
@ -224,6 +223,66 @@ Rectangle {
}
}
Item {
width: parent.width
height: parent.height - 40
anchors.top: navigation_bar.bottom
visible: ["local", "domain"].includes(pageVal) ? false : true
Column {
width: parent.width - 10
height: parent.height - 10
anchors.centerIn: parent
spacing: 0
Rectangle {
width: parent.width
height: 40
color: "transparent"
Text{
text: "External window"
color: "white"
font.pointSize: 12
anchors.verticalCenter: parent.verticalCenter
}
CheckBox{
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
onCheckedChanged: {
toScript({type: 'setting_change', setting: 'external_window', value: checked})
}
}
}
Rectangle {
width: parent.width
height: 40
color: Qt.rgba(0.15,0.15,0.15,1);
Text{
text: "Erase chat history"
color: "white"
font.pointSize: 12
anchors.verticalCenter: parent.verticalCenter
}
Button {
anchors.right: parent.right
text: "Erase"
height: parent.height
anchors.verticalCenter: parent.verticalCenter
onClicked: {
toScript({type: "action", action: "erase_history"})
}
}
}
}
}
}
Component {