Updated variable names.

Removed dead/unused code.
This commit is contained in:
armored-dragon 2025-04-20 06:00:25 -05:00
parent 8b39297929
commit 1f68081a37
No known key found for this signature in database
GPG key ID: C7207ACC3382AD8B
5 changed files with 31 additions and 37 deletions

View file

@ -12,15 +12,15 @@ Rectangle {
anchors.centerIn: parent;
anchors.horizontalCenter: parent.horizontalCenter
property var pages: [
{name: "General", icon: "../img/overte.svg", target_page: "hifi/tablet/TabletGeneralPreferences.qml" },
{name: "Graphics", icon: "../img/computer.svg", target_page: "" },
{name: "Audio", icon: "../img/volume.svg", target_page: "hifi/audio/Audio.qml" },
{name: "Controls", icon: "../img/dpad.svg", target_page: "hifi/tablet/ControllerSettings.qml" },
{name: "Security", icon: "../img/badge.svg", target_page: "hifi/dialogs/security/Security.qml" },
{name: "QML Allowlist", icon: "../img/lock.svg", target_page: "hifi/dialogs/security/EntityScriptQMLAllowlist.qml" },
{name: "Script Security", icon: "../img/shield.svg", target_page: "hifi/dialogs/security/ScriptSecurity.qml" },
{name: "General", icon: "../img/overte.svg", targetPage: "hifi/tablet/TabletGeneralPreferences.qml" },
{name: "Graphics", icon: "../img/computer.svg", targetPage: "" },
{name: "Audio", icon: "../img/volume.svg", targetPage: "hifi/audio/Audio.qml" },
{name: "Controls", icon: "../img/dpad.svg", targetPage: "hifi/tablet/ControllerSettings.qml" },
{name: "Security", icon: "../img/badge.svg", targetPage: "hifi/dialogs/security/Security.qml" },
{name: "QML Allowlist", icon: "../img/lock.svg", targetPage: "hifi/dialogs/security/EntityScriptQMLAllowlist.qml" },
{name: "Script Security", icon: "../img/shield.svg", targetPage: "hifi/dialogs/security/ScriptSecurity.qml" },
];
property string current_page: "Settings"
property string currentPage: "Settings"
ColumnLayout {
width: parent.width
@ -35,16 +35,16 @@ Rectangle {
// Home page
SettingCenterContainer {
id: home_page
visible: current_page == "Settings"
id: homePage
visible: currentPage == "Settings"
Layout.fillHeight: true
Repeater {
model: pages.length;
delegate: SettingSubviewListElement {
property string page_name: pages[index].name;
property string page_icon: pages[index].icon;
property string target_page: pages[index].target_page;
property string pageName: pages[index].name;
property string pageIcon: pages[index].icon;
property string targetPage: pages[index].targetPage;
}
}
}
@ -52,12 +52,6 @@ Rectangle {
// Graphics
GraphicsSettings {}
// Audio
SettingCenterContainer {
id: audio_page
visible: current_page == "Audio"
}
// Templates
}
@ -65,7 +59,7 @@ Rectangle {
function fromScript(message) {
switch (message.type){
case "loadPage":
current_page = message.page;
currentPage = message.page;
break;
}
}

View file

@ -17,7 +17,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter
height: 40
width: 40
x: current_page == "Settings" ? -40 : 10
x: currentPage == "Settings" ? -40 : 10
Behavior on x {
NumberAnimation {
@ -29,13 +29,13 @@ Item {
MouseArea {
anchors.fill: parent
onClicked: {
current_page = "Settings";
currentPage = "Settings";
}
}
}
Text {
text: current_page
text: currentPage
color: "white"
font.pixelSize: 26
anchors.horizontalCenter: parent.horizontalCenter

View file

@ -36,7 +36,7 @@ Item {
Image {
sourceSize.height: 25;
source: page_icon;
source: pageIcon;
anchors.centerIn: parent;
}
}
@ -44,7 +44,7 @@ Item {
// Page name
Text {
id: pageNameElement
text: page_name;
text: pageName;
color: "white";
font.pixelSize: 24;
anchors.verticalCenter: parent.verticalCenter;
@ -71,11 +71,11 @@ Item {
onClicked: {
Tablet.playSound(TabletEnums.ButtonClicked);
if (target_page !== "") {
toScript({type:"switch_app", app_url: target_page});
if (targetPage !== "") {
toScript({type:"switchApp", appUrl: targetPage});
return;
}
current_page = page_name;
currentPage = pageName;
}
onEntered: {

View file

@ -6,13 +6,13 @@ import "../"
Flickable {
property var verticalScrollBarWidth: 20;
id: graphics_page;
visible: current_page == "Graphics";
id: graphicsPage;
visible: currentPage == "Graphics";
width: parent.width;
Layout.fillHeight: true;
y: header.height + 10;
contentWidth: parent.width;
contentHeight: graphics_page_column.height;
contentHeight: graphicsPageColumn.height;
clip: true;
flickDeceleration: 4000;
@ -59,7 +59,7 @@ Flickable {
}
Column {
id: graphics_page_column;
id: graphicsPageColumn;
width: parent.width - 20;
anchors.horizontalCenterOffset: -5
anchors.horizontalCenter: parent.horizontalCenter;

View file

@ -63,8 +63,8 @@
});
}
function onTabletScreenChanged(type, new_url) {
if (url == new_url) active = true;
function onTabletScreenChanged(type, newUrl) {
if (url == newUrl) active = true;
else active = false;
appButton.editProperties({
@ -76,13 +76,13 @@
function fromQML(event) {
console.log(`New QML event:\n${JSON.stringify(event)}`);
if (event.type === "switch_app") {
if (event.app_url == "hifi/dialogs/GeneralPreferencesDialog.qml") {
if (event.type === "switchApp") {
if (event.appUrl == "hifi/dialogs/GeneralPreferencesDialog.qml") {
// This page needs to be opened like this just because.
Desktop.show("hifi/dialogs/GeneralPreferencesDialog.qml", "GeneralPreferencesDialog");
return;
}
tablet.loadQMLSource(event.app_url);
tablet.loadQMLSource(event.appUrl);
}
}
/**