mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 18:02:13 +02:00
QML works, C++ works but does a manual set to true, does not see updates from QML set setting.
This commit is contained in:
parent
61943d0edb
commit
98473abbb4
3 changed files with 33 additions and 35 deletions
|
@ -21,8 +21,7 @@ import "../../../windows"
|
|||
|
||||
|
||||
Rectangle {
|
||||
id: "parentBody";
|
||||
property var checkboxReady: "false";
|
||||
id: parentBody;
|
||||
|
||||
function getWhitelistAsText() {
|
||||
var whitelist = Settings.getValue("private/settingsSafeURLS");
|
||||
|
@ -60,14 +59,13 @@ Rectangle {
|
|||
Settings.setValue("private/whitelistEnabled", enabled);
|
||||
console.info("NANI?",enabled);
|
||||
}
|
||||
|
||||
|
||||
function initCheckbox() {
|
||||
var check = Settings.getValue("private/whitelistEnabled");
|
||||
|
||||
console.info("Triggered init. Val:", check);
|
||||
if (check == "true") {
|
||||
whiteListEnabled.checked = "true";
|
||||
parentBody.checkboxReady = "true";
|
||||
if (check == true) {
|
||||
whitelistEnabled.toggle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,32 +92,29 @@ Rectangle {
|
|||
height: 60;
|
||||
|
||||
CheckBox {
|
||||
Component.onCompleted: {
|
||||
initCheckbox();
|
||||
}
|
||||
|
||||
id: whiteListEnabled;
|
||||
|
||||
anchors.right: parent.right;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 10;
|
||||
onCheckedChanged: {
|
||||
console.info("Triggered.0");
|
||||
if (parentBody.checkboxReady == "true") {
|
||||
console.info("Resolved.0");
|
||||
toggleWhitelist(whiteListEnabled.checked)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "Enabled"
|
||||
color: "white"
|
||||
font.pixelSize: 18;
|
||||
anchors.right: parent.left;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 10;
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
initCheckbox();
|
||||
}
|
||||
|
||||
id: whitelistEnabled;
|
||||
|
||||
anchors.right: parent.right;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 10;
|
||||
onToggled: {
|
||||
console.info("Triggered.0");
|
||||
toggleWhitelist(whitelistEnabled.checked)
|
||||
}
|
||||
|
||||
Label {
|
||||
text: "Enabled"
|
||||
color: "white"
|
||||
font.pixelSize: 18;
|
||||
anchors.right: parent.left;
|
||||
anchors.top: parent.top;
|
||||
anchors.topMargin: 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
|
|
@ -2370,7 +2370,9 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
|||
safeURLPrefixes += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts);
|
||||
|
||||
// ENTITY SCRIPT WHITELIST TOGGLE CHECK
|
||||
bool whitelistEnabled = whitelistEnabledSetting.get();
|
||||
bool whitelistEnabled = _whitelistEnabled.get();
|
||||
|
||||
_whitelistEnabled.set(true);
|
||||
|
||||
if (!whitelistEnabled) {
|
||||
passList = true;
|
||||
|
|
|
@ -973,9 +973,10 @@ protected:
|
|||
|
||||
Setting::Handle<bool> _enableExtendedJSExceptions { _SETTINGS_ENABLE_EXTENDED_EXCEPTIONS, true };
|
||||
|
||||
Setting::Handle<bool> whitelistEnabledSetting { "DELME/whitelistEnabled", false }; // Set to false if not exist.
|
||||
|
||||
QWeakPointer<ScriptEngines> _scriptEngines;
|
||||
|
||||
Setting::Handle<bool> _whitelistEnabled{"private/whitelistEnabled", false };
|
||||
|
||||
};
|
||||
|
||||
ScriptEnginePointer scriptEngineFactory(ScriptEngine::Context context,
|
||||
|
|
Loading…
Reference in a new issue