mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-02 00:08:08 +02:00
Merge pull request #7 from kasenvr/feature/whitelist-qml-cpp-ui
Added a confirmation message + instructions to the QML.
This commit is contained in:
commit
aa911f3c27
1 changed files with 60 additions and 3 deletions
|
@ -29,10 +29,32 @@ Rectangle {
|
||||||
return whitelistText;
|
return whitelistText;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWhiteListAsText(whitelistText) {
|
function setWhitelistAsText(whitelistText) {
|
||||||
Settings.setValue("private/settingsSafeURLS", whitelistText.text);
|
Settings.setValue("private/settingsSafeURLS", whitelistText.text);
|
||||||
|
|
||||||
|
var originalSetString = whitelistText.text;
|
||||||
|
var originalSet = originalSetString.split(' ').join('');
|
||||||
|
|
||||||
|
var check = Settings.getValue("private/settingsSafeURLS");
|
||||||
|
var arrayCheck = check.split(",");
|
||||||
|
var textCheck = arrayCheck.join("\n");
|
||||||
|
|
||||||
|
if(textCheck == originalSet) {
|
||||||
|
setWhitelistSuccess(true);
|
||||||
|
} else {
|
||||||
|
setWhitelistSuccess(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setWhitelistSuccess(success) {
|
||||||
|
if(success) {
|
||||||
|
notificationText.text = "Successfully saved settings.";
|
||||||
|
} else {
|
||||||
|
notificationText.text = "Error! Settings not saved.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: 120;
|
height: 120;
|
||||||
|
@ -74,6 +96,7 @@ Rectangle {
|
||||||
TextArea {
|
TextArea {
|
||||||
id: whitelistTextArea
|
id: whitelistTextArea
|
||||||
text: getWhitelistAsText();
|
text: getWhitelistAsText();
|
||||||
|
onTextChanged: notificationText.text = "";
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
font.family: "Ubuntu";
|
font.family: "Ubuntu";
|
||||||
|
@ -87,7 +110,7 @@ Rectangle {
|
||||||
anchors.topMargin: 5;
|
anchors.topMargin: 5;
|
||||||
anchors.leftMargin: 20;
|
anchors.leftMargin: 20;
|
||||||
anchors.rightMargin: 20;
|
anchors.rightMargin: 20;
|
||||||
x: textAreaRectangle.x + textAreaRectangle.width - width - 5;
|
x: textAreaRectangle.x + textAreaRectangle.width - width - 15;
|
||||||
y: textAreaRectangle.y + textAreaRectangle.height - height;
|
y: textAreaRectangle.y + textAreaRectangle.height - height;
|
||||||
contentItem: Text {
|
contentItem: Text {
|
||||||
text: saveChanges.text
|
text: saveChanges.text
|
||||||
|
@ -100,7 +123,41 @@ Rectangle {
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
text: "Save Changes"
|
text: "Save Changes"
|
||||||
onClicked: setWhiteListAsText(whitelistTextArea)
|
onClicked: setWhitelistAsText(whitelistTextArea)
|
||||||
|
|
||||||
|
HifiStylesUit.RalewayRegular {
|
||||||
|
id: notificationText;
|
||||||
|
text: ""
|
||||||
|
// Text size
|
||||||
|
size: 14;
|
||||||
|
// Style
|
||||||
|
color: "white";
|
||||||
|
elide: Text.ElideLeft;
|
||||||
|
// Anchors
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 130;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiStylesUit.RalewayRegular {
|
||||||
|
id: descriptionText;
|
||||||
|
text: "Separate your URLs by line, not commas. Example:
|
||||||
|
https://google.com/
|
||||||
|
https://bing.com/
|
||||||
|
https://mydomain.here/
|
||||||
|
\nEnsure there are no spaces or whitespace."
|
||||||
|
// Text size
|
||||||
|
size: 16;
|
||||||
|
// Style
|
||||||
|
color: "white";
|
||||||
|
elide: Text.ElideRight;
|
||||||
|
// Anchors
|
||||||
|
anchors.top: parent.bottom;
|
||||||
|
anchors.topMargin: 90;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.leftMargin: 20;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.rightMargin: 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue