remove debug outputs per Dante's request

This commit is contained in:
Alexander Ivash 2018-06-21 22:37:03 +03:00
parent bc6bfc1003
commit 9b5135b66b
3 changed files with 1 additions and 103 deletions

View file

@ -33,7 +33,6 @@ Rectangle {
signal sendToScript(var message); signal sendToScript(var message);
function emitSendToScript(message) { function emitSendToScript(message) {
console.debug('AvatarApp.qml: emitting sendToScript: ', JSON.stringify(message, null, '\t'));
sendToScript(message); sendToScript(message);
} }
@ -56,9 +55,7 @@ Rectangle {
xmlhttp.onreadystatechange = function() { xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState === XMLHttpRequest.DONE && xmlhttp.status === 200) { if (xmlhttp.readyState === XMLHttpRequest.DONE && xmlhttp.status === 200) {
try { try {
console.debug('xmlhttp: ', xmlhttp.status, 'got responseText: ', xmlhttp.responseText);
var marketResponse = JSON.parse(xmlhttp.responseText.trim()) var marketResponse = JSON.parse(xmlhttp.responseText.trim())
console.debug('got market response: ', JSON.stringify(marketResponse));
if(marketResponse.status === 'success') { if(marketResponse.status === 'success') {
avatar.modelName = marketResponse.data.title; avatar.modelName = marketResponse.data.title;
@ -74,7 +71,6 @@ Rectangle {
} }
function getAvatarModelName() { function getAvatarModelName() {
console.debug('executing getAvatarModelName()');
if(currentAvatar === null) { if(currentAvatar === null) {
return ''; return '';
@ -100,19 +96,13 @@ Rectangle {
property int avatarWearablesCount: currentAvatar ? currentAvatar.wearables.count : 0 property int avatarWearablesCount: currentAvatar ? currentAvatar.wearables.count : 0
property var currentAvatar: null; property var currentAvatar: null;
function setCurrentAvatar(avatar, bookmarkName) { function setCurrentAvatar(avatar, bookmarkName) {
var currentAvatarObject = allAvatars.makeAvatarObject(avatar, bookmarkName); var currentAvatarObject = allAvatars.makeAvatarObject(avatar, bookmarkName);
currentAvatar = currentAvatarModel.makeAvatarEntry(currentAvatarObject); currentAvatar = currentAvatarModel.makeAvatarEntry(currentAvatarObject);
console.debug('AvatarApp.qml: currentAvatarObject: ', currentAvatarObject, 'currentAvatar: ', currentAvatar, JSON.stringify(currentAvatar.wearables, 0, 4));
console.debug('currentAvatar.wearables: ', currentAvatar.wearables);
} }
property url externalAvatarThumbnailUrl: '../../images/avatarapp/guy-in-circle.svg' property url externalAvatarThumbnailUrl: '../../images/avatarapp/guy-in-circle.svg'
function fromScript(message) { function fromScript(message) {
console.debug('AvatarApp.qml: fromScript: ', JSON.stringify(message, null, '\t'))
if(message.method === 'initialize') { if(message.method === 'initialize') {
jointNames = message.data.jointNames; jointNames = message.data.jointNames;
emitSendToScript({'method' : getAvatarsMethod}); emitSendToScript({'method' : getAvatarsMethod});
@ -129,12 +119,10 @@ Rectangle {
currentAvatar.avatarScale = message.value; currentAvatar.avatarScale = message.value;
updateCurrentAvatarInBookmarks(currentAvatar); updateCurrentAvatarInBookmarks(currentAvatar);
} else if(message.method === 'externalAvatarApplied') { } else if(message.method === 'externalAvatarApplied') {
console.debug('externalAvatarApplied...');
currentAvatar.avatarUrl = message.avatarURL; currentAvatar.avatarUrl = message.avatarURL;
currentAvatar.thumbnailUrl = allAvatars.makeThumbnailUrl(message.avatarURL); currentAvatar.thumbnailUrl = allAvatars.makeThumbnailUrl(message.avatarURL);
currentAvatar.entry.avatarUrl = currentAvatar.avatarUrl; currentAvatar.entry.avatarUrl = currentAvatar.avatarUrl;
currentAvatar.modelName = undefined; currentAvatar.modelName = undefined;
console.debug('externalAvatarApplied: ', currentAvatar.avatarUrl, currentAvatar.thumbnailUrl);
updateCurrentAvatarInBookmarks(currentAvatar); updateCurrentAvatarInBookmarks(currentAvatar);
} else if(message.method === 'settingChanged') { } else if(message.method === 'settingChanged') {
currentAvatarSettings[message.name] = message.value; currentAvatarSettings[message.name] = message.value;
@ -164,8 +152,6 @@ Rectangle {
var index = pageOfAvatars.findAvatarIndex(message.name); var index = pageOfAvatars.findAvatarIndex(message.name);
var absoluteIndex = view.currentPage * view.itemsPerPage + index var absoluteIndex = view.currentPage * view.itemsPerPage + index
console.debug('removed ', absoluteIndex, 'view.currentPage', view.currentPage,
'view.itemsPerPage: ', view.itemsPerPage, 'index', index, 'pageOfAvatars', pageOfAvatars, 'pageOfAvatars.count', pageOfAvatars)
allAvatars.remove(absoluteIndex) allAvatars.remove(absoluteIndex)
pageOfAvatars.remove(index); pageOfAvatars.remove(index);
@ -173,8 +159,6 @@ Rectangle {
var itemsOnPage = pageOfAvatars.count; var itemsOnPage = pageOfAvatars.count;
var newItemIndex = view.currentPage * view.itemsPerPage + itemsOnPage; var newItemIndex = view.currentPage * view.itemsPerPage + itemsOnPage;
console.debug('newItemIndex: ', newItemIndex, 'allAvatars.count - 1: ', allAvatars.count - 1, 'pageOfAvatars.count:', pageOfAvatars.count);
if(newItemIndex <= (allAvatars.count - 1)) { if(newItemIndex <= (allAvatars.count - 1)) {
pageOfAvatars.append(allAvatars.get(newItemIndex)); pageOfAvatars.append(allAvatars.get(newItemIndex));
} else { } else {
@ -182,7 +166,6 @@ Rectangle {
pageOfAvatars.appendGetAvatars(); pageOfAvatars.appendGetAvatars();
} }
console.debug('removed ', absoluteIndex, 'newItemIndex: ', newItemIndex, 'allAvatars.count:', allAvatars.count, 'pageOfAvatars.count:', pageOfAvatars.count)
pageOfAvatars.isUpdating = false; pageOfAvatars.isUpdating = false;
} else if(message.method === getAvatarsMethod) { } else if(message.method === getAvatarsMethod) {
var getAvatarsData = message.data; var getAvatarsData = message.data;
@ -191,7 +174,6 @@ Rectangle {
displayNameInput.text = getAvatarsData.displayName; displayNameInput.text = getAvatarsData.displayName;
currentAvatarSettings = getAvatarsData.currentAvatarSettings; currentAvatarSettings = getAvatarsData.currentAvatarSettings;
console.debug('currentAvatar: ', JSON.stringify(currentAvatar, null, '\t'));
updateCurrentAvatarInBookmarks(currentAvatar); updateCurrentAvatarInBookmarks(currentAvatar);
} else if(message.method === 'updateAvatarInBookmarks') { } else if(message.method === 'updateAvatarInBookmarks') {
updateCurrentAvatarInBookmarks(currentAvatar); updateCurrentAvatarInBookmarks(currentAvatar);
@ -201,16 +183,11 @@ Rectangle {
} }
function updateCurrentAvatarInBookmarks(avatar) { function updateCurrentAvatarInBookmarks(avatar) {
console.debug('searching avatar in bookmarks... ');
var bookmarkAvatarIndex = allAvatars.findAvatarIndexByValue(avatar); var bookmarkAvatarIndex = allAvatars.findAvatarIndexByValue(avatar);
if(bookmarkAvatarIndex === -1) { if(bookmarkAvatarIndex === -1) {
console.debug('bookmarkAvatarIndex = -1, avatar is not favorite')
avatar.name = ''; avatar.name = '';
view.setPage(0); view.setPage(0);
} else { } else {
console.debug('bookmarkAvatarIndex = ', bookmarkAvatarIndex, 'avatar is among favorites!')
var bookmarkAvatar = allAvatars.get(bookmarkAvatarIndex); var bookmarkAvatar = allAvatars.get(bookmarkAvatarIndex);
avatar.name = bookmarkAvatar.name; avatar.name = bookmarkAvatar.name;
view.selectAvatar(bookmarkAvatar); view.selectAvatar(bookmarkAvatar);
@ -282,7 +259,6 @@ Rectangle {
} }
onScaleChanged: { onScaleChanged: {
console.debug('AvatarApp.qml: onScaleChanged: ', scale);
emitSendToScript({'method' : 'setScale', 'avatarScale' : scale}) emitSendToScript({'method' : 'setScale', 'avatarScale' : scale})
} }
} }
@ -434,7 +410,6 @@ Rectangle {
onClicked: { onClicked: {
createFavorite.onSaveClicked = function() { createFavorite.onSaveClicked = function() {
var entry = currentAvatar.entry; var entry = currentAvatar.entry;
console.debug('was: ', JSON.stringify(entry, 0, 4));
var wearables = []; var wearables = [];
for(var i = 0; i < currentAvatar.wearables.count; ++i) { for(var i = 0; i < currentAvatar.wearables.count; ++i) {
@ -443,7 +418,6 @@ Rectangle {
entry.avatarEntites = wearables; entry.avatarEntites = wearables;
currentAvatar.name = createFavorite.favoriteNameText; currentAvatar.name = createFavorite.favoriteNameText;
console.debug('became: ', JSON.stringify(entry, 0, 4));
emitSendToScript({'method': 'addAvatar', 'name' : currentAvatar.name}); emitSendToScript({'method': 'addAvatar', 'name' : currentAvatar.name});
createFavorite.close(); createFavorite.close();
@ -500,7 +474,6 @@ Rectangle {
var url = popup.inputText.text; var url = popup.inputText.text;
emitSendToScript({'method' : 'applyExternalAvatar', 'avatarURL' : url}) emitSendToScript({'method' : 'applyExternalAvatar', 'avatarURL' : url})
}, function(link) { }, function(link) {
console.debug('link clicked', link);
Qt.openUrlExternally(link); Qt.openUrlExternally(link);
}); });
} }
@ -517,7 +490,6 @@ Rectangle {
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
console.debug('adjustWearables.open');
adjustWearables.open(currentAvatar); adjustWearables.open(currentAvatar);
} }
} }
@ -537,7 +509,6 @@ Rectangle {
popup.showGetWearables(function() { popup.showGetWearables(function() {
emitSendToScript({'method' : 'navigate', 'url' : 'hifi://AvatarIsland/11.5848,-8.10862,-2.80195'}) emitSendToScript({'method' : 'navigate', 'url' : 'hifi://AvatarIsland/11.5848,-8.10862,-2.80195'})
}, function(link) { }, function(link) {
console.debug('link clicked', link);
emitSendToScript({'method' : 'navigate', 'url' : link}) emitSendToScript({'method' : 'navigate', 'url' : link})
}); });
} }
@ -618,25 +589,13 @@ Rectangle {
property int itemsPerPage: 8 property int itemsPerPage: 8
property int totalPages: Math.ceil((allAvatars.count + 1) / itemsPerPage) property int totalPages: Math.ceil((allAvatars.count + 1) / itemsPerPage)
onTotalPagesChanged: {
console.debug('total pages: ', totalPages)
}
property int currentPage: 0; property int currentPage: 0;
onCurrentPageChanged: { onCurrentPageChanged: {
console.debug('currentPage: ', currentPage)
currentIndex = Qt.binding(currentAvatarIndexInBookmarksPage); currentIndex = Qt.binding(currentAvatarIndexInBookmarksPage);
} }
property bool hasNext: currentPage < (totalPages - 1) property bool hasNext: currentPage < (totalPages - 1)
onHasNextChanged: {
console.debug('hasNext: ', hasNext)
}
property bool hasPrev: currentPage > 0 property bool hasPrev: currentPage > 0
onHasPrevChanged: {
console.debug('hasPrev: ', hasPrev)
}
function setPage(pageIndex) { function setPage(pageIndex) {
pageOfAvatars.isUpdating = true; pageOfAvatars.isUpdating = true;
@ -646,7 +605,6 @@ Rectangle {
for(var itemIndex = 0; start < end; ++start, ++itemIndex) { for(var itemIndex = 0; start < end; ++start, ++itemIndex) {
var avatarItem = allAvatars.get(start) var avatarItem = allAvatars.get(start)
console.debug('getting ', start, avatarItem)
pageOfAvatars.append(avatarItem); pageOfAvatars.append(avatarItem);
} }
@ -654,7 +612,6 @@ Rectangle {
pageOfAvatars.appendGetAvatars(); pageOfAvatars.appendGetAvatars();
currentPage = pageIndex; currentPage = pageIndex;
console.debug('switched to the page with', pageOfAvatars.count, 'items')
pageOfAvatars.isUpdating = false; pageOfAvatars.isUpdating = false;
} }
@ -675,7 +632,6 @@ Rectangle {
function removeGetAvatars() { function removeGetAvatars() {
if(hasGetAvatars()) { if(hasGetAvatars()) {
remove(count - 1) remove(count - 1)
console.debug('removed get avatars...');
} }
} }
} }
@ -721,12 +677,8 @@ Rectangle {
border.color: container.highlighted ? style.colors.blueHighlight : 'transparent' border.color: container.highlighted ? style.colors.blueHighlight : 'transparent'
border.width: container.highlighted ? 4 : 0 border.width: container.highlighted ? 4 : 0
wearablesCount: { wearablesCount: {
console.debug('getMoreAvatars: ', getMoreAvatars, 'name: ', name);
return !getMoreAvatars ? wearables.count : 0 return !getMoreAvatars ? wearables.count : 0
} }
onWearablesCountChanged: {
console.debug('delegate: AvatarThumbnail.wearablesCount: ', wearablesCount)
}
visible: !getMoreAvatars visible: !getMoreAvatars
@ -793,7 +745,6 @@ Rectangle {
popup.showBuyAvatars(function() { popup.showBuyAvatars(function() {
emitSendToScript({'method' : 'navigate', 'url' : 'hifi://BodyMart'}) emitSendToScript({'method' : 'navigate', 'url' : 'hifi://BodyMart'})
}, function(link) { }, function(link) {
console.debug('link clicked', link);
emitSendToScript({'method' : 'navigate', 'url' : link}) emitSendToScript({'method' : 'navigate', 'url' : link})
}); });
} }

View file

@ -23,17 +23,11 @@ Rectangle {
modified = false; modified = false;
} }
onModifiedChanged: {
console.debug('modified: ', modified)
}
property var jointNames; property var jointNames;
property string avatarName: '' property string avatarName: ''
property var wearablesModel; property var wearablesModel;
function open(avatar) { function open(avatar) {
console.debug('AdjustWearables.qml: open: *', JSON.stringify(avatar, null, '\t'));
adjustWearablesOpened(avatar.name); adjustWearablesOpened(avatar.name);
visible = true; visible = true;
@ -43,21 +37,12 @@ Rectangle {
} }
function refresh(avatar) { function refresh(avatar) {
console.debug('refresh: ');
for(var i = 0; i < avatar.wearables.count; ++i) {
console.debug('wearable: ', avatar.wearables.get(i).properties.id);
}
wearablesCombobox.model.clear(); wearablesCombobox.model.clear();
console.debug('AdjustWearables.qml: open: avatar.wearables.count: ', avatar.wearables.count);
for(var i = 0; i < avatar.wearables.count; ++i) { for(var i = 0; i < avatar.wearables.count; ++i) {
var wearable = avatar.wearables.get(i).properties; var wearable = avatar.wearables.get(i).properties;
console.debug('wearable: ', JSON.stringify(wearable, null, '\t'))
for(var j = (wearable.modelURL.length - 1); j >= 0; --j) { for(var j = (wearable.modelURL.length - 1); j >= 0; --j) {
if(wearable.modelURL[j] === '/') { if(wearable.modelURL[j] === '/') {
wearable.text = wearable.modelURL.substring(j + 1) + ' [%jointIndex%]'.replace('%jointIndex%', jointNames[wearable.parentJointIndex]); wearable.text = wearable.modelURL.substring(j + 1) + ' [%jointIndex%]'.replace('%jointIndex%', jointNames[wearable.parentJointIndex]);
console.debug('wearable.text = ', wearable.text);
break; break;
} }
} }
@ -73,7 +58,6 @@ Rectangle {
} }
var wearable = wearablesCombobox.model.get(wearableIndex); var wearable = wearablesCombobox.model.get(wearableIndex);
console.debug('refreshWearable: ', wearableID, JSON.stringify(wearable, 0, 4));
if(!wearable) { if(!wearable) {
return; return;
@ -82,10 +66,6 @@ Rectangle {
var wearableModelItemProperties = wearablesModel.get(wearableIndex).properties; var wearableModelItemProperties = wearablesModel.get(wearableIndex).properties;
for(var prop in properties) { for(var prop in properties) {
console.debug('updated wearable', prop,
'old = ', JSON.stringify(wearable[prop], 0, 4),
'new = ', JSON.stringify(properties[prop], 0, 4));
wearable[prop] = properties[prop]; wearable[prop] = properties[prop];
wearableModelItemProperties[prop] = wearable[prop]; wearableModelItemProperties[prop] = wearable[prop];
@ -100,10 +80,7 @@ Rectangle {
} }
} }
console.debug('wearableModelItemProperties: ', JSON.stringify(wearableModelItemProperties, 0, 4))
wearablesModel.setProperty(wearableIndex, 'properties', wearableModelItemProperties); wearablesModel.setProperty(wearableIndex, 'properties', wearableModelItemProperties);
console.debug('wearablesModel.get(wearableIndex).properties: ', JSON.stringify(wearablesModel.get(wearableIndex).properties, 0, 4))
} }
function getCurrentWearable() { function getCurrentWearable() {
@ -165,8 +142,6 @@ Rectangle {
} }
comboBox.onCurrentIndexChanged: { comboBox.onCurrentIndexChanged: {
console.debug('wearable index changed: ', currentIndex);
var currentWearable = getCurrentWearable(); var currentWearable = getCurrentWearable();
if(currentWearable) { if(currentWearable) {
@ -207,8 +182,6 @@ Rectangle {
yvalue = localPosition.y yvalue = localPosition.y
zvalue = localPosition.z zvalue = localPosition.z
notify = true; notify = true;
console.debug('position.set: localPosition = ', JSON.stringify(localPosition, 0, 4))
} }
function notifyPositionChanged() { function notifyPositionChanged() {
@ -261,8 +234,6 @@ Rectangle {
yvalue = localRotationAngles.y yvalue = localRotationAngles.y
zvalue = localRotationAngles.z zvalue = localRotationAngles.z
notify = true; notify = true;
console.debug('localRotationAngles = ', JSON.stringify(localRotationAngles, 0, 4))
} }
function notifyRotationChanged() { function notifyRotationChanged() {
@ -317,8 +288,6 @@ Rectangle {
notify = false; notify = false;
realValue = value realValue = value
notify = true; notify = true;
console.debug('scale = ', realValue)
} }
function notifyScaleChanged() { function notifyScaleChanged() {

View file

@ -8,9 +8,7 @@ ListModel {
var regexp = new RegExp(guidRegexp,["i"]); var regexp = new RegExp(guidRegexp,["i"]);
var match = regexp.exec(avatarUrl); var match = regexp.exec(avatarUrl);
if (match !== null) if (match !== null) {
{
console.debug('marketplaceId guid', match[1]);
return match[1]; return match[1];
} }
@ -36,10 +34,7 @@ ListModel {
} }
function makeAvatarObject(avatar, avatarName) { function makeAvatarObject(avatar, avatarName) {
console.debug('makeAvatarEntry: ', avatarName, JSON.stringify(avatar));
var avatarThumbnailUrl = makeThumbnailUrl(avatar.avatarUrl); var avatarThumbnailUrl = makeThumbnailUrl(avatar.avatarUrl);
console.debug('avatarThumbnailUrl:', avatarThumbnailUrl);
return { return {
'name' : avatarName, 'name' : avatarName,
@ -55,8 +50,6 @@ ListModel {
} }
function addAvatarEntry(avatar, avatarName) { function addAvatarEntry(avatar, avatarName) {
console.debug('addAvatarEntry: ', avatarName);
var avatarEntry = makeAvatarObject(avatar, avatarName); var avatarEntry = makeAvatarObject(avatar, avatarName);
append(avatarEntry); append(avatarEntry);
@ -138,8 +131,6 @@ ListModel {
} }
function compareObjects(o1, o2, props, arrayProp) { function compareObjects(o1, o2, props, arrayProp) {
console.debug('compare ojects: o1 = ', JSON.stringify(o1, null, 4), 'o2 = ', JSON.stringify(o2, null, 4));
for(var i = 0; i < props.length; ++i) { for(var i = 0; i < props.length; ++i) {
var prop = props[i]; var prop = props[i];
var propertyName = prop.propertyName; var propertyName = prop.propertyName;
@ -148,21 +139,13 @@ ListModel {
var o1Value = arrayProp ? o1[arrayProp][propertyName] : o1[propertyName]; var o1Value = arrayProp ? o1[arrayProp][propertyName] : o1[propertyName];
var o2Value = arrayProp ? o2[arrayProp][propertyName] : o2[propertyName]; var o2Value = arrayProp ? o2[arrayProp][propertyName] : o2[propertyName];
console.debug('compare values for key: ', propertyName, comparer ? 'using specified comparer' : 'using default comparer', ', o1 = ', JSON.stringify(o1Value, null, 4), 'o2 = ', JSON.stringify(o2Value, null, 4));
if(comparer) { if(comparer) {
if(comparer(o1Value, o2Value) === false) { if(comparer(o1Value, o2Value) === false) {
console.debug('comparer: not equal');
return false; return false;
} else {
console.debug('comparer: equal');
} }
} else { } else {
if(JSON.stringify(o1Value) !== JSON.stringify(o2Value)) { if(JSON.stringify(o1Value) !== JSON.stringify(o2Value)) {
console.debug('not equal');
return false; return false;
} else {
console.debug('equal');
} }
} }
} }
@ -192,10 +175,8 @@ ListModel {
function findAvatarIndexByValue(avatar) { function findAvatarIndexByValue(avatar) {
var index = -1; var index = -1;
console.debug('findAvatarIndexByValue: ', 'name = ', avatar.name);
// 2DO: find better way of determining selected avatar in bookmarks // 2DO: find better way of determining selected avatar in bookmarks
console.debug('allAvatars.count: ', allAvatars.count);
for(var i = 0; i < allAvatars.count; ++i) { for(var i = 0; i < allAvatars.count; ++i) {
var thesame = true; var thesame = true;
var bookmarkedAvatar = allAvatars.get(i); var bookmarkedAvatar = allAvatars.get(i);
@ -226,7 +207,6 @@ ListModel {
function findAvatarIndex(avatarName) { function findAvatarIndex(avatarName) {
for(var i = 0; i < count; ++i) { for(var i = 0; i < count; ++i) {
if(get(i).name === avatarName) { if(get(i).name === avatarName) {
console.debug('avatar found by index: ', i)
return i; return i;
} }
} }
@ -234,8 +214,6 @@ ListModel {
} }
function findAvatar(avatarName) { function findAvatar(avatarName) {
console.debug('AvatarsModel: find avatar by', avatarName);
var avatarIndex = findAvatarIndex(avatarName); var avatarIndex = findAvatarIndex(avatarName);
if(avatarIndex === -1) if(avatarIndex === -1)
return undefined; return undefined;