mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 16:50:43 +02:00
Added filter for QT autogenerated functions and integrated it to Developers menu
This commit is contained in:
parent
54297e00a8
commit
38bfddf786
3 changed files with 215 additions and 167 deletions
|
@ -18,10 +18,7 @@ Item {
|
|||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
property var hideQtMethods: true
|
||||
|
||||
property var maxUpdateValues: 20
|
||||
property var maxReloadValues: 200
|
||||
|
@ -375,9 +372,6 @@ Item {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
HifiControls.GlyphButton {
|
||||
|
@ -417,6 +411,30 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
HifiControls.CheckBox {
|
||||
id: hideQt
|
||||
boxSize: 25
|
||||
boxRadius: 3
|
||||
checked: true
|
||||
anchors.left: clipboard.right
|
||||
anchors.leftMargin: 8
|
||||
anchors.verticalCenter: clipboard.verticalCenter
|
||||
anchors.margins: 2
|
||||
onClicked: {
|
||||
hideQtMethods = checked;
|
||||
addListElements();
|
||||
}
|
||||
}
|
||||
|
||||
HifiControls.Label {
|
||||
id: hideLabel
|
||||
anchors.left: hideQt.right
|
||||
anchors.verticalCenter: clipboard.verticalCenter
|
||||
anchors.margins: 2
|
||||
font.pixelSize: 15
|
||||
text: "Hide Qt Methods"
|
||||
}
|
||||
|
||||
HifiControls.Keyboard {
|
||||
id: keyboard;
|
||||
raised: false;
|
||||
|
@ -425,7 +443,7 @@ Item {
|
|||
left: parent.left;
|
||||
right: parent.right;
|
||||
}
|
||||
// "\ue02b"
|
||||
|
||||
Keys.onPressed: {
|
||||
console.log(event.nativeScanCode);
|
||||
if (event.key == Qt.Key_Left) {
|
||||
|
@ -434,8 +452,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function addNewMember() {
|
||||
apiMembers.push({member: searchBar.text, type: "user", value: valueBar.text, hasValue: true});
|
||||
var data = {'memberIndex': apiMembers.length-1, 'apiMember': searchBar.text, 'apiType':"user", 'apiValue': valueBar.text};
|
||||
|
@ -595,8 +611,18 @@ Item {
|
|||
'apiType': filteredArray[i].type,
|
||||
'apiValue': filteredArray[i].value};
|
||||
|
||||
if (hideQtMethods) {
|
||||
var chain = data.apiMember.split(".");
|
||||
var method = chain[chain.length-1];
|
||||
if (method != "destroyed" &&
|
||||
method != "objectName" &&
|
||||
method != "objectNameChanged") {
|
||||
memberModel.append(data);
|
||||
}
|
||||
} else {
|
||||
memberModel.append(data);
|
||||
}
|
||||
}
|
||||
|
||||
computeMembersWithValues();
|
||||
|
||||
|
|
|
@ -757,6 +757,14 @@ Menu::Menu() {
|
|||
// Developer > Stats
|
||||
addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::Stats);
|
||||
|
||||
// Developer > API Debugger
|
||||
action = addActionToQMenuAndActionHash(developerMenu, "API Debugger");
|
||||
connect(action, &QAction::triggered, [] {
|
||||
auto scriptEngines = DependencyManager::get<ScriptEngines>();
|
||||
QUrl defaultScriptsLoc = PathUtils::defaultScriptsLocation();
|
||||
defaultScriptsLoc.setPath(defaultScriptsLoc.path() + "developer/utilities/tools/currentAPI.js");
|
||||
scriptEngines->loadScript(defaultScriptsLoc.toString());
|
||||
});
|
||||
|
||||
#if 0 /// -------------- REMOVED FOR NOW --------------
|
||||
addDisabledActionAndSeparator(navigateMenu, "History");
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
//
|
||||
// currentAPI.js
|
||||
// examples
|
||||
//
|
||||
// Created by Clément Brisset on 5/30/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
(function(){
|
||||
var array = [];
|
||||
var mainKeys = Object.keys(this);
|
||||
|
@ -14,7 +26,7 @@
|
|||
}
|
||||
|
||||
var window = new OverlayWindow({
|
||||
title: 'API methods',
|
||||
title: 'API Debugger',
|
||||
source: qml,
|
||||
width: 1200,
|
||||
height: 500
|
||||
|
@ -33,7 +45,7 @@
|
|||
|
||||
function memberHasValue(member, type) {
|
||||
if (type === "function()") {
|
||||
if (member.indexOf(".has") < 0 && member.indexOf(".is") < 0) {
|
||||
if (member.indexOf(".has") < 0 && member.indexOf(".is") < 0 && member.indexOf(".get") < 0) {
|
||||
return false;
|
||||
}
|
||||
if (member.indexOf("indow") < 0) {
|
||||
|
@ -57,6 +69,8 @@
|
|||
if (chain.length > 1) {
|
||||
string = chain[0];
|
||||
type = "function(" + chain[1];
|
||||
} else {
|
||||
type = "function()";
|
||||
}
|
||||
}
|
||||
var value = "";
|
||||
|
|
Loading…
Reference in a new issue