mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:41:20 +02:00
Added Settings.
Erase messages. Toggle external window. Signed-off-by: Armored Dragon <publicmail@armoreddragon.com>
This commit is contained in:
parent
002fdf0b42
commit
0d5eb93241
2 changed files with 84 additions and 4 deletions
|
@ -129,12 +129,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function fromQML(event) {
|
function fromQML(event) {
|
||||||
console.log(`New web event:\n${JSON.stringify(event)}`);
|
console.log(`New QML event:\n${JSON.stringify(event)}`);
|
||||||
|
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "send_message":
|
case "send_message":
|
||||||
_sendMessage(event.message, event.channel);
|
_sendMessage(event.message, event.channel);
|
||||||
break;
|
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":
|
case "initialized":
|
||||||
// https://github.com/overte-org/overte/issues/824
|
// 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)
|
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)
|
||||||
|
|
|
@ -26,9 +26,8 @@ Rectangle {
|
||||||
// toScript({type: "initialized"})
|
// toScript({type: "initialized"})
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Column {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
// Navigation Bar
|
// Navigation Bar
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -135,6 +134,7 @@ Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - 40
|
height: parent.height - 40
|
||||||
anchors.top: navigation_bar.bottom
|
anchors.top: navigation_bar.bottom
|
||||||
|
visible: ["local", "domain"].includes(pageVal) ? true : false
|
||||||
|
|
||||||
|
|
||||||
// Chat Message History
|
// Chat Message History
|
||||||
|
@ -180,7 +180,6 @@ Rectangle {
|
||||||
height: 40
|
height: 40
|
||||||
color: Qt.rgba(0.9,0.9,0.9,1)
|
color: Qt.rgba(0.9,0.9,0.9,1)
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
visible: ["local", "domain"].includes(pageVal) ? true : false
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
width: parent.width
|
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 {
|
Component {
|
||||||
|
|
Loading…
Reference in a new issue