logging groups for library/shared and interface

This commit is contained in:
Seth Alves 2015-04-06 18:45:06 -07:00
parent cd5245d0d6
commit fb607e2b26
30 changed files with 254 additions and 171 deletions

View file

@ -94,6 +94,7 @@
#include "Menu.h"
#include "ModelPackager.h"
#include "Util.h"
#include "InterfaceLogging.h"
#include "avatar/AvatarManager.h"
@ -330,7 +331,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
_applicationStartupTime = startup_time;
qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
qCDebug(interface) << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
_bookmarks = new Bookmarks(); // Before setting up the menu
@ -528,7 +529,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
// check first run...
if (_firstRun.get()) {
qDebug() << "This is a first run...";
qCDebug(interface) << "This is a first run...";
// clear the scripts, and set out script to our default scripts
clearScriptsBeforeRunning();
loadScript(DEFAULT_SCRIPTS_JS_URL);
@ -649,7 +650,7 @@ Application::~Application() {
}
void Application::initializeGL() {
qDebug() << "Created Display Window.";
qCDebug(interface) << "Created Display Window.";
// initialize glut for shape drawing; Qt apparently initializes it on OS X
#ifndef __APPLE__
@ -661,22 +662,22 @@ void Application::initializeGL() {
}
#endif
qDebug() << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
qDebug() << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
qDebug() << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
qDebug() << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
qCDebug(interface) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
qCDebug(interface) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
qCDebug(interface) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
qCDebug(interface) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
#ifdef WIN32
GLenum err = glewInit();
if (GLEW_OK != err) {
/* Problem: glewInit failed, something is seriously wrong. */
qDebug("Error: %s\n", glewGetErrorString(err));
/* Problem: glewInit failed, something is seriously wrong. */
qCDebug(interface, "Error: %s\n", glewGetErrorString(err));
}
qDebug("Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
qCDebug(interface, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
if (wglewGetExtension("WGL_EXT_swap_control")) {
int swapInterval = wglGetSwapIntervalEXT();
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
qCDebug(interface, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
}
#endif
@ -684,15 +685,15 @@ void Application::initializeGL() {
// TODO: Write the correct code for Linux...
/* if (wglewGetExtension("WGL_EXT_swap_control")) {
int swapInterval = wglGetSwapIntervalEXT();
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
qCDebug(interface, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
}*/
#endif
initDisplay();
qDebug( "Initialized Display.");
qCDebug(interface, "Initialized Display.");
init();
qDebug( "init() complete.");
qCDebug(interface, "init() complete.");
// create thread for parsing of octee data independent of the main network and rendering threads
_octreeProcessor.initialize(_enableProcessOctreeThread);
@ -713,7 +714,7 @@ void Application::initializeGL() {
if (_justStarted) {
float startupTime = (float)_applicationStartupTime.elapsed() / 1000.0;
_justStarted = false;
qDebug("Startup time: %4.2f seconds.", startupTime);
qCDebug(interface, "Startup time: %4.2f seconds.", startupTime);
}
// update before the first render
@ -1800,7 +1801,7 @@ bool Application::exportEntities(const QString& filename, float x, float y, floa
}
exportTree.writeToSVOFile(filename.toLocal8Bit().constData());
} else {
qDebug() << "No models were selected";
qCDebug(interface) << "No models were selected";
return false;
}
@ -1898,7 +1899,7 @@ void Application::init() {
DependencyManager::get<AddressManager>()->loadSettings(addressLookupString);
qDebug() << "Loaded settings";
qCDebug(interface) << "Loaded settings";
#ifdef __APPLE__
if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseEnabled)) {
@ -2379,7 +2380,7 @@ int Application::sendNackPackets() {
void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
//qDebug() << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
//qCDebug(interface) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
bool wantExtraDebugging = getLogger()->extraDebugging();
// These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
@ -2442,7 +2443,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
});
if (wantExtraDebugging) {
qDebug("Servers: total %d, in view %d, unknown jurisdiction %d",
qCDebug(interface, "Servers: total %d, in view %d, unknown jurisdiction %d",
totalServers, inViewServers, unknownJurisdictionServers);
}
@ -2463,7 +2464,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
}
if (wantExtraDebugging) {
qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer);
qCDebug(interface, "perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer);
}
nodeList->eachNode([&](const SharedNodePointer& node){
@ -2482,7 +2483,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
if (jurisdictions.find(nodeUUID) == jurisdictions.end()) {
unknownView = true; // assume it's in view
if (wantExtraDebugging) {
qDebug() << "no known jurisdiction for node " << *node << ", assume it's visible.";
qCDebug(interface) << "no known jurisdiction for node " << *node << ", assume it's visible.";
}
} else {
const JurisdictionMap& map = (jurisdictions)[nodeUUID];
@ -2502,7 +2503,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
}
} else {
if (wantExtraDebugging) {
qDebug() << "Jurisdiction without RootCode for node " << *node << ". That's unusual!";
qCDebug(interface) << "Jurisdiction without RootCode for node " << *node << ". That's unusual!";
}
}
}
@ -2511,7 +2512,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
_octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS);
} else if (unknownView) {
if (wantExtraDebugging) {
qDebug() << "no known jurisdiction for node " << *node << ", give it budget of "
qCDebug(interface) << "no known jurisdiction for node " << *node << ", give it budget of "
<< perUnknownServer << " to send us jurisdiction.";
}
@ -2525,11 +2526,11 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
_octreeQuery.setCameraNearClip(0.1f);
_octreeQuery.setCameraFarClip(0.1f);
if (wantExtraDebugging) {
qDebug() << "Using 'minimal' camera position for node" << *node;
qCDebug(interface) << "Using 'minimal' camera position for node" << *node;
}
} else {
if (wantExtraDebugging) {
qDebug() << "Using regular camera position for node" << *node;
qCDebug(interface) << "Using regular camera position for node" << *node;
}
}
_octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer);
@ -3296,13 +3297,13 @@ void Application::updateWindowTitle(){
#ifndef WIN32
// crashes with vs2013/win32
qDebug("Application title set to: %s", title.toStdString().c_str());
qCDebug(interface, "Application title set to: %s", title.toStdString().c_str());
#endif
_window->setWindowTitle(title);
}
void Application::clearDomainOctreeDetails() {
qDebug() << "Clearing domain octree details...";
qCDebug(interface) << "Clearing domain octree details...";
// reset the environment so that we don't erroneously end up with multiple
_environment.resetToDefault();
@ -3374,7 +3375,7 @@ void Application::nodeKilled(SharedNodePointer node) {
voxelDetailsForCode(rootCode, rootDetails);
_entityServerJurisdictions.unlock();
qDebug("model server going away...... v[%f, %f, %f, %f]",
qCDebug(interface, "model server going away...... v[%f, %f, %f, %f]",
rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s);
// Add the jurisditionDetails object to the list of "fade outs"
@ -3460,7 +3461,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin
if (jurisdiction->find(nodeUUID) == jurisdiction->end()) {
jurisdiction->unlock();
qDebug("stats from new %s server... [%f, %f, %f, %f]",
qCDebug(interface, "stats from new %s server... [%f, %f, %f, %f]",
qPrintable(serverType), rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s);
// Add the jurisditionDetails object to the list of "fade outs"
@ -3706,7 +3707,7 @@ bool Application::askToSetAvatarUrl(const QString& url) {
QNetworkRequest networkRequest = QNetworkRequest(url);
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
QNetworkReply* reply = networkAccessManager.get(networkRequest);
qDebug() << "Downloading avatar file at " << url;
qCDebug(interface) << "Downloading avatar file at " << url;
QEventLoop loop;
QObject::connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
loop.exec();
@ -3755,13 +3756,13 @@ bool Application::askToSetAvatarUrl(const QString& url) {
msgBox.exec();
if (msgBox.clickedButton() == headButton) {
qDebug() << "Chose to use for head: " << url;
qCDebug(interface) << "Chose to use for head: " << url;
_myAvatar->setFaceModelURL(url);
UserActivityLogger::getInstance().changedModel("head", url);
_myAvatar->sendIdentityPacket();
emit faceURLChanged(url);
} else if (msgBox.clickedButton() == bodyButton) {
qDebug() << "Chose to use for body: " << url;
qCDebug(interface) << "Chose to use for body: " << url;
_myAvatar->setSkeletonModelURL(url);
// if the head is empty, reset it to the default head.
if (_myAvatar->getFaceModelURLString().isEmpty()) {
@ -3773,7 +3774,7 @@ bool Application::askToSetAvatarUrl(const QString& url) {
_myAvatar->sendIdentityPacket();
emit skeletonURLChanged(url);
} else if (msgBox.clickedButton() == bodyAndHeadButton) {
qDebug() << "Chose to use for body + head: " << url;
qCDebug(interface) << "Chose to use for body + head: " << url;
_myAvatar->setFaceModelURL(QString());
_myAvatar->setSkeletonModelURL(url);
UserActivityLogger::getInstance().changedModel("skeleton", url);
@ -3781,7 +3782,7 @@ bool Application::askToSetAvatarUrl(const QString& url) {
emit faceURLChanged(QString());
emit skeletonURLChanged(url);
} else {
qDebug() << "Declined to use the avatar: " << url;
qCDebug(interface) << "Declined to use the avatar: " << url;
}
return true;
}
@ -3793,10 +3794,10 @@ bool Application::askToLoadScript(const QString& scriptFilenameOrURL) {
reply = QMessageBox::question(getWindow(), "Run Script", message, QMessageBox::Yes|QMessageBox::No);
if (reply == QMessageBox::Yes) {
qDebug() << "Chose to run the script: " << scriptFilenameOrURL;
qCDebug(interface) << "Chose to run the script: " << scriptFilenameOrURL;
loadScript(scriptFilenameOrURL);
} else {
qDebug() << "Declined to run the script: " << scriptFilenameOrURL;
qCDebug(interface) << "Declined to run the script: " << scriptFilenameOrURL;
}
return true;
}
@ -3854,7 +3855,7 @@ void Application::handleScriptEngineLoaded(const QString& scriptFilename) {
}
void Application::handleScriptLoadError(const QString& scriptFilename) {
qDebug() << "Application::loadScript(), script failed to load...";
qCDebug(interface) << "Application::loadScript(), script failed to load...";
QMessageBox::warning(getWindow(), "Error Loading Script", scriptFilename + " failed to load.");
}
@ -3876,7 +3877,7 @@ void Application::stopAllScripts(bool restart) {
connect(it.value(), SIGNAL(finished(const QString&)), SLOT(loadScript(const QString&)));
}
it.value()->stop();
qDebug() << "stopping script..." << it.key();
qCDebug(interface) << "stopping script..." << it.key();
}
// HACK: ATM scripts cannot set/get their animation priorities, so we clear priorities
// whenever a script stops in case it happened to have been setting joint rotations.
@ -3888,7 +3889,7 @@ void Application::stopScript(const QString &scriptName) {
const QString& scriptURLString = QUrl(scriptName).toString();
if (_scriptEnginesHash.contains(scriptURLString)) {
_scriptEnginesHash.value(scriptURLString)->stop();
qDebug() << "stopping script..." << scriptName;
qCDebug(interface) << "stopping script..." << scriptName;
// HACK: ATM scripts cannot set/get their animation priorities, so we clear priorities
// whenever a script stops in case it happened to have been setting joint rotations.
// TODO: expose animation priorities and provide a layered animation control system.
@ -3986,8 +3987,8 @@ void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject
voxelWalletUUID = QUuid(voxelObject[VOXEL_WALLET_UUID].toString());
}
qDebug() << "Octree edits costs are" << satoshisPerVoxel << "per octree cell and" << satoshisPerMeterCubed << "per meter cubed";
qDebug() << "Destination wallet UUID for edit payments is" << voxelWalletUUID;
qCDebug(interface) << "Octree edits costs are" << satoshisPerVoxel << "per octree cell and" << satoshisPerMeterCubed << "per meter cubed";
qCDebug(interface) << "Destination wallet UUID for edit payments is" << voxelWalletUUID;
}
QString Application::getPreviousScriptLocation() {
@ -4152,9 +4153,9 @@ void Application::setVSyncEnabled() {
if (wglewGetExtension("WGL_EXT_swap_control")) {
wglSwapIntervalEXT(vsyncOn);
int swapInterval = wglGetSwapIntervalEXT();
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
qCDebug(interface, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
} else {
qDebug("V-Sync is FORCED ON on this system\n");
qCDebug(interface, "V-Sync is FORCED ON on this system\n");
}
#elif defined(Q_OS_LINUX)
// TODO: write the poper code for linux
@ -4163,13 +4164,13 @@ void Application::setVSyncEnabled() {
glxSwapIntervalEXT(vsyncOn);
int swapInterval = xglGetSwapIntervalEXT();
_isVSyncOn = swapInterval;
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
qCDebug(interface, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
} else {
qDebug("V-Sync is FORCED ON on this system\n");
qCDebug(interface, "V-Sync is FORCED ON on this system\n");
}
*/
#else
qDebug("V-Sync is FORCED ON on this system\n");
qCDebug(interface, "V-Sync is FORCED ON on this system\n");
#endif
}
@ -4285,7 +4286,7 @@ void Application::notifyPacketVersionMismatch() {
void Application::checkSkeleton() {
if (_myAvatar->getSkeletonModel().isActive() && !_myAvatar->getSkeletonModel().hasSkeleton()) {
qDebug() << "MyAvatar model has no skeleton";
qCDebug(interface) << "MyAvatar model has no skeleton";
QString message = "Your selected avatar body has no skeleton.\n\nThe default body will be loaded...";
QMessageBox msgBox;

View file

@ -23,6 +23,7 @@
#include "MainWindow.h"
#include "Menu.h"
#include "InterfaceLogging.h"
#include "Bookmarks.h"
@ -35,7 +36,7 @@ void Bookmarks::insert(const QString& name, const QString& address) {
_bookmarks.insert(name, address);
if (contains(name)) {
qDebug() << "Added bookmark:" << name << "," << address;
qCDebug(interface) << "Added bookmark:" << name << "," << address;
persistToFile();
} else {
qWarning() << "Couldn't add bookmark: " << name << "," << address;
@ -46,7 +47,7 @@ void Bookmarks::remove(const QString& name) {
_bookmarks.remove(name);
if (!contains(name)) {
qDebug() << "Deleted bookmark:" << name;
qCDebug(interface) << "Deleted bookmark:" << name;
persistToFile();
} else {
qWarning() << "Couldn't delete bookmark:" << name;

View file

@ -18,6 +18,7 @@
#include "avatar/AvatarManager.h"
#include "AudioClient.h"
#include "Menu.h"
#include "InterfaceLogging.h"
#include "DatagramProcessor.h"
@ -125,8 +126,8 @@ void DatagramProcessor::processDatagrams() {
// output to the log so the user knows they got a denied connection request
// and check and signal for an access token so that we can make sure they are logged in
qDebug() << "The domain-server denied a connection request: " << reason;
qDebug() << "You may need to re-log to generate a keypair so you can provide a username signature.";
qCDebug(interface) << "The domain-server denied a connection request: " << reason;
qCDebug(interface) << "You may need to re-log to generate a keypair so you can provide a username signature.";
application->domainConnectionDenied(reason);
AccountManager::getInstance().checkAndSignalForAccessToken();
break;

View file

@ -24,6 +24,7 @@
#include "Application.h"
#include "Camera.h"
#include "world.h"
#include "InterfaceLogging.h"
#include "Environment.h"
@ -49,7 +50,7 @@ Environment::~Environment() {
void Environment::init() {
if (_initialized) {
qDebug("[ERROR] Environment is already initialized.");
qCDebug(interface, "[ERROR] Environment is already initialized.");
return;
}

View file

@ -0,0 +1,14 @@
//
// InterfaceLogging.h
// libraries/interface/src
//
// Created by Seth Alves on 4/6/15.
// 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
//
#include "InterfaceLogging.h"
Q_LOGGING_CATEGORY(interface, "hifi.interface")

View file

@ -0,0 +1,14 @@
//
// InterfaceLogging.h
// interface/src
//
// Created by Seth Alves on 4/6/15.
// 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
//
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(interface)

View file

@ -14,6 +14,7 @@
#include "Application.h"
#include "ui/DialogsManager.h"
#include "InterfaceLogging.h"
#include "LODManager.h"
@ -78,7 +79,7 @@ void LODManager::autoAdjustLOD(float currentFPS) {
doDownShift = _fpsAverageDownWindow.getAverage() < getLODDecreaseFPS();
if (!doDownShift) {
qDebug() << "---- WE APPEAR TO BE DONE DOWN SHIFTING -----";
qCDebug(interface) << "---- WE APPEAR TO BE DONE DOWN SHIFTING -----";
_isDownshifting = false;
_lastStable = now;
}
@ -102,7 +103,7 @@ void LODManager::autoAdjustLOD(float currentFPS) {
if (changed) {
if (_isDownshifting) {
// subsequent downshift
qDebug() << "adjusting LOD DOWN..."
qCDebug(interface) << "adjusting LOD DOWN..."
<< "average fps for last "<< DOWN_SHIFT_WINDOW_IN_SECS <<"seconds was "
<< _fpsAverageDownWindow.getAverage()
<< "minimum is:" << getLODDecreaseFPS()
@ -110,7 +111,7 @@ void LODManager::autoAdjustLOD(float currentFPS) {
<< " NEW _octreeSizeScale=" << _octreeSizeScale;
} else {
// first downshift
qDebug() << "adjusting LOD DOWN after initial delay..."
qCDebug(interface) << "adjusting LOD DOWN after initial delay..."
<< "average fps for last "<< START_DELAY_WINDOW_IN_SECS <<"seconds was "
<< _fpsAverageStartWindow.getAverage()
<< "minimum is:" << getLODDecreaseFPS()
@ -145,7 +146,7 @@ void LODManager::autoAdjustLOD(float currentFPS) {
}
if (changed) {
qDebug() << "adjusting LOD UP... average fps for last "<< UP_SHIFT_WINDOW_IN_SECS <<"seconds was "
qCDebug(interface) << "adjusting LOD UP... average fps for last "<< UP_SHIFT_WINDOW_IN_SECS <<"seconds was "
<< _fpsAverageUpWindow.getAverage()
<< "upshift point is:" << getLODIncreaseFPS()
<< "elapsedSinceUpShift:" << elapsedSinceUpShift

View file

@ -39,6 +39,7 @@
#include "ui/DialogsManager.h"
#include "ui/NodeBounds.h"
#include "ui/StandAloneJSConsole.h"
#include "InterfaceLogging.h"
#include "Menu.h"
@ -51,7 +52,7 @@ Menu* Menu::getInstance() {
menuInstanceMutex.lock();
if (!_instance) {
qDebug("First call to Menu::getInstance() - initing menu.");
qCDebug(interface, "First call to Menu::getInstance() - initing menu.");
_instance = new Menu();
}
@ -743,7 +744,7 @@ void Menu::triggerOption(const QString& menuOption) {
if (action) {
action->trigger();
} else {
qDebug() << "NULL Action for menuOption '" << menuOption << "'";
qCDebug(interface) << "NULL Action for menuOption '" << menuOption << "'";
}
}
@ -987,7 +988,7 @@ void Menu::setVisibility() {
} else if (Menu::getInstance()->isOptionChecked(MenuOption::VisibleToNoOne)) {
discoverabilityManager->setDiscoverabilityMode(Discoverability::None);
} else {
qDebug() << "ERROR Menu::setVisibility() called with unrecognized value.";
qCDebug(interface) << "ERROR Menu::setVisibility() called with unrecognized value.";
}
}
@ -999,6 +1000,6 @@ void Menu::visibilityChanged(Discoverability::Mode discoverabilityMode) {
} else if (discoverabilityMode == Discoverability::None) {
setIsOptionChecked(MenuOption::VisibleToNoOne, true);
} else {
qDebug() << "ERROR Menu::visibilityChanged() called with unrecognized value.";
qCDebug(interface) << "ERROR Menu::visibilityChanged() called with unrecognized value.";
}
}

View file

@ -18,6 +18,7 @@
#include "ModelSelector.h"
#include "ModelPropertiesDialog.h"
#include "InterfaceLogging.h"
#include "ModelPackager.h"
@ -84,7 +85,7 @@ bool ModelPackager::loadModel() {
qWarning() << QString("ModelPackager::loadModel(): Could not open FST file %1").arg(_modelFile.filePath());
return false;
}
qDebug() << "Reading FST file : " << _modelFile.filePath();
qCDebug(interface) << "Reading FST file : " << _modelFile.filePath();
_mapping = FSTReader::readMapping(fst.readAll());
fst.close();
@ -103,7 +104,7 @@ bool ModelPackager::loadModel() {
qWarning() << QString("ModelPackager::loadModel(): Could not open FBX file %1").arg(_fbxInfo.filePath());
return false;
}
qDebug() << "Reading FBX file : " << _fbxInfo.filePath();
qCDebug(interface) << "Reading FBX file : " << _fbxInfo.filePath();
QByteArray fbxContents = fbx.readAll();
_geometry = readFBX(fbxContents, QVariantHash());
@ -188,7 +189,7 @@ bool ModelPackager::zipModel() {
fst.write(FSTReader::writeMapping(_mapping));
fst.close();
} else {
qDebug() << "Couldn't write FST file" << fst.fileName();
qCDebug(interface) << "Couldn't write FST file" << fst.fileName();
return false;
}
@ -196,7 +197,7 @@ bool ModelPackager::zipModel() {
QString saveDirPath = QFileDialog::getExistingDirectory(nullptr, "Save Model",
"", QFileDialog::ShowDirsOnly);
if (saveDirPath.isEmpty()) {
qDebug() << "Invalid directory" << saveDirPath;
qCDebug(interface) << "Invalid directory" << saveDirPath;
return false;
}
@ -404,7 +405,7 @@ bool ModelPackager::copyTextures(const QString& oldDir, const QDir& newDir) {
if (!errors.isEmpty()) {
QMessageBox::warning(nullptr, "ModelPackager::copyTextures()",
"Missing textures:" + errors);
qDebug() << "ModelPackager::copyTextures():" << errors;
qCDebug(interface) << "ModelPackager::copyTextures():" << errors;
return false;
}

View file

@ -19,6 +19,7 @@
#include "Application.h"
#include "Menu.h"
#include "InterfaceLogging.h"
#include "ScriptsModel.h"
@ -181,7 +182,7 @@ void ScriptsModel::downloadFinished() {
if (!data.isEmpty()) {
finished = parseXML(data);
} else {
qDebug() << "Error: Received no data when loading remote scripts";
qCDebug(interface) << "Error: Received no data when loading remote scripts";
}
}
@ -230,7 +231,7 @@ bool ScriptsModel::parseXML(QByteArray xmlFile) {
// Error handling
if (xml.hasError()) {
qDebug() << "Error loading remote scripts: " << xml.errorString();
qCDebug(interface) << "Error loading remote scripts: " << xml.errorString();
return true;
}

View file

@ -12,6 +12,7 @@
#include <QtGlobal>
#include <QDebug>
#include "InterfaceLogging.h"
#include "SpeechRecognizer.h"
#if defined(Q_OS_WIN)
@ -139,13 +140,13 @@ void SpeechRecognizer::setEnabled(bool enabled) {
_enabled = SUCCEEDED(hr);
qDebug() << "Speech recognition" << (_enabled ? "enabled" : "enable failed");
qCDebug(interface) << "Speech recognition" << (_enabled ? "enabled" : "enable failed");
} else {
_commandRecognizedNotifier->setEnabled(false);
static_cast<ISpRecoContext*>(_speechRecognizerContext)->Release();
static_cast<ISpRecognizer*>(_speechRecognizer)->Release();
qDebug() << "Speech recognition disabled";
qCDebug(interface) << "Speech recognition disabled";
}
emit enabledUpdated(_enabled);
@ -207,7 +208,7 @@ void SpeechRecognizer::reloadCommands() {
}
if (FAILED(hr)) {
qDebug() << "ERROR: Didn't successfully reload speech commands";
qCDebug(interface) << "ERROR: Didn't successfully reload speech commands";
}
}

View file

@ -27,6 +27,7 @@
#include "InterfaceConfig.h"
#include "world.h"
#include "Application.h"
#include "InterfaceLogging.h"
#include "Util.h"
@ -136,43 +137,43 @@ void runTimingTests() {
float NSEC_TO_USEC = 1.0f / 1000.0f;
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("QElapsedTimer::nsecElapsed() usecs: %f", elapsedUsecs);
qCDebug(interface, "QElapsedTimer::nsecElapsed() usecs: %f", elapsedUsecs);
// Test sleep functions for accuracy
startTime.start();
QThread::msleep(1);
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("QThread::msleep(1) ms: %f", elapsedUsecs / 1000.0f);
qCDebug(interface, "QThread::msleep(1) ms: %f", elapsedUsecs / 1000.0f);
startTime.start();
QThread::sleep(1);
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("QThread::sleep(1) ms: %f", elapsedUsecs / 1000.0f);
qCDebug(interface, "QThread::sleep(1) ms: %f", elapsedUsecs / 1000.0f);
startTime.start();
usleep(1);
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("usleep(1) ms: %f", elapsedUsecs / 1000.0f);
qCDebug(interface, "usleep(1) ms: %f", elapsedUsecs / 1000.0f);
startTime.start();
usleep(10);
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("usleep(10) ms: %f", elapsedUsecs / 1000.0f);
qCDebug(interface, "usleep(10) ms: %f", elapsedUsecs / 1000.0f);
startTime.start();
usleep(100);
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("usleep(100) ms: %f", elapsedUsecs / 1000.0f);
qCDebug(interface, "usleep(100) ms: %f", elapsedUsecs / 1000.0f);
startTime.start();
usleep(1000);
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("usleep(1000) ms: %f", elapsedUsecs / 1000.0f);
qCDebug(interface, "usleep(1000) ms: %f", elapsedUsecs / 1000.0f);
startTime.start();
usleep(15000);
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("usleep(15000) ms: %f", elapsedUsecs / 1000.0f);
qCDebug(interface, "usleep(15000) ms: %f", elapsedUsecs / 1000.0f);
// Random number generation
startTime.start();
@ -180,7 +181,7 @@ void runTimingTests() {
iResults[i] = rand();
}
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("rand() stored in array usecs: %f, first result:%d", elapsedUsecs / (float) numTests, iResults[0]);
qCDebug(interface, "rand() stored in array usecs: %f, first result:%d", elapsedUsecs / (float) numTests, iResults[0]);
// Random number generation using randFloat()
startTime.start();
@ -188,7 +189,7 @@ void runTimingTests() {
fResults[i] = randFloat();
}
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("randFloat() stored in array usecs: %f, first result: %f", elapsedUsecs / (float) numTests, fResults[0]);
qCDebug(interface, "randFloat() stored in array usecs: %f, first result: %f", elapsedUsecs / (float) numTests, fResults[0]);
free(iResults);
free(fResults);
@ -200,7 +201,7 @@ void runTimingTests() {
fTest = powf(fTest, 0.5f);
}
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("powf(f, 0.5) usecs: %f", elapsedUsecs / (float) numTests);
qCDebug(interface, "powf(f, 0.5) usecs: %f", elapsedUsecs / (float) numTests);
// Vector Math
float distance;
@ -212,7 +213,7 @@ void runTimingTests() {
distance = glm::distance(pointA, pointB);
}
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("vector math usecs: %f [%f usecs total for %d tests], last result:%f",
qCDebug(interface, "vector math usecs: %f [%f usecs total for %d tests], last result:%f",
elapsedUsecs / (float) numTests, elapsedUsecs, numTests, distance);
// Vec3 test
@ -225,7 +226,7 @@ void runTimingTests() {
result = glm::dot(temp,temp);
}
elapsedUsecs = (float)startTime.nsecsElapsed() * NSEC_TO_USEC;
qDebug("vec3 assign and dot() usecs: %f, last result:%f", elapsedUsecs / (float) numTests, result);
qCDebug(interface, "vec3 assign and dot() usecs: %f, last result:%f", elapsedUsecs / (float) numTests, result);
}
bool rayIntersectsSphere(const glm::vec3& rayStarting, const glm::vec3& rayNormalizedDirection,

View file

@ -46,6 +46,7 @@
#include "Util.h"
#include "world.h"
#include "devices/OculusManager.h"
#include "InterfaceLogging.h"
using namespace std;
@ -138,7 +139,7 @@ void Avatar::simulate(float deltaTime) {
this);
break;
default:
qDebug() << "[WARNING] Avatar::simulate(): Unknown referential type.";
qCDebug(interface) << "[WARNING] Avatar::simulate(): Unknown referential type.";
break;
}
}

View file

@ -13,6 +13,7 @@
#include <EntityTree.h>
#include <Model.h>
#include "InterfaceLogging.h"
#include "ModelReferential.h"
ModelReferential::ModelReferential(Referential* referential, EntityTree* tree, AvatarData* avatar) :
@ -25,7 +26,7 @@ ModelReferential::ModelReferential(Referential* referential, EntityTree* tree, A
referential->getExtraData().size());
if (!isValid()) {
qDebug() << "ModelReferential::copyConstructor(): Not Valid";
qCDebug(interface) << "ModelReferential::copyConstructor(): Not Valid";
return;
}
@ -45,7 +46,7 @@ ModelReferential::ModelReferential(const QUuid& entityID, EntityTree* tree, Avat
{
const EntityItem* item = _tree->findEntityByID(_entityID);
if (!isValid() || item == NULL) {
qDebug() << "ModelReferential::constructor(): Not Valid";
qCDebug(interface) << "ModelReferential::constructor(): Not Valid";
_isValid = false;
return;
}
@ -100,7 +101,7 @@ JointReferential::JointReferential(Referential* referential, EntityTree* tree, A
{
_type = JOINT;
if (!isValid()) {
qDebug() << "JointReferential::copyConstructor(): Not Valid";
qCDebug(interface) << "JointReferential::copyConstructor(): Not Valid";
return;
}
@ -122,7 +123,7 @@ JointReferential::JointReferential(uint32_t jointIndex, const QUuid& entityID, E
const EntityItem* item = _tree->findEntityByID(_entityID);
const Model* model = getModel(item);
if (!isValid() || model == NULL || _jointIndex >= (uint32_t)(model->getJointStateCount())) {
qDebug() << "JointReferential::constructor(): Not Valid";
qCDebug(interface) << "JointReferential::constructor(): Not Valid";
_isValid = false;
return;
}

View file

@ -43,6 +43,7 @@
#include "devices/Faceshift.h"
#include "devices/OculusManager.h"
#include "Util.h"
#include "InterfaceLogging.h"
using namespace std;
@ -308,7 +309,7 @@ void MyAvatar::renderDebugBodyPoints() {
glm::vec3 headPosition(getHead()->getEyePosition());
float torsoToHead = glm::length(headPosition - torsoPosition);
glm::vec3 position;
qDebug("head-above-torso %.2f, scale = %0.2f", torsoToHead, getScale());
qCDebug(interface, "head-above-torso %.2f, scale = %0.2f", torsoToHead, getScale());
// Torso Sphere
position = torsoPosition;
@ -447,7 +448,7 @@ void MyAvatar::stopRecording() {
void MyAvatar::saveRecording(QString filename) {
if (!_recorder) {
qDebug() << "There is no recording to save";
qCDebug(interface) << "There is no recording to save";
return;
}
if (QThread::currentThread() != thread()) {
@ -466,7 +467,7 @@ void MyAvatar::loadLastRecording() {
return;
}
if (!_recorder) {
qDebug() << "There is no recording to load";
qCDebug(interface) << "There is no recording to load";
return;
}
if (!_player) {
@ -780,7 +781,7 @@ AttachmentData MyAvatar::loadAttachmentData(const QUrl& modelURL, const QString&
}
int MyAvatar::parseDataAtOffset(const QByteArray& packet, int offset) {
qDebug() << "Error: ignoring update packet for MyAvatar"
qCDebug(interface) << "Error: ignoring update packet for MyAvatar"
<< " packetLength = " << packet.size()
<< " offset = " << offset;
// this packet is just bad, so we pretend that we unpacked it ALL
@ -1331,33 +1332,33 @@ void MyAvatar::maybeUpdateBillboard() {
void MyAvatar::increaseSize() {
if ((1.0f + SCALING_RATIO) * _targetScale < MAX_AVATAR_SCALE) {
_targetScale *= (1.0f + SCALING_RATIO);
qDebug("Changed scale to %f", _targetScale);
qCDebug(interface, "Changed scale to %f", _targetScale);
}
}
void MyAvatar::decreaseSize() {
if (MIN_AVATAR_SCALE < (1.0f - SCALING_RATIO) * _targetScale) {
_targetScale *= (1.0f - SCALING_RATIO);
qDebug("Changed scale to %f", _targetScale);
qCDebug(interface, "Changed scale to %f", _targetScale);
}
}
void MyAvatar::resetSize() {
_targetScale = 1.0f;
qDebug("Reseted scale to %f", _targetScale);
qCDebug(interface, "Reseted scale to %f", _targetScale);
}
void MyAvatar::goToLocation(const glm::vec3& newPosition,
bool hasOrientation, const glm::quat& newOrientation,
bool shouldFaceLocation) {
qDebug().nospace() << "MyAvatar goToLocation - moving to " << newPosition.x << ", "
qCDebug(interface).nospace() << "MyAvatar goToLocation - moving to " << newPosition.x << ", "
<< newPosition.y << ", " << newPosition.z;
glm::vec3 shiftedPosition = newPosition;
if (hasOrientation) {
qDebug().nospace() << "MyAvatar goToLocation - new orientation is "
qCDebug(interface).nospace() << "MyAvatar goToLocation - new orientation is "
<< newOrientation.x << ", " << newOrientation.y << ", " << newOrientation.z << ", " << newOrientation.w;
// orient the user to face the target

View file

@ -18,6 +18,8 @@
#include "DdeFaceTracker.h"
#include "FaceshiftConstants.h"
#include "InterfaceLogging.h"
static const QHostAddress DDE_FEATURE_POINT_SERVER_ADDR("127.0.0.1");
static const quint16 DDE_FEATURE_POINT_SERVER_PORT = 5555;
@ -175,7 +177,7 @@ bool DdeFaceTracker::isActive() const {
//private slots and methods
void DdeFaceTracker::socketErrorOccurred(QAbstractSocket::SocketError socketError) {
qDebug() << "[Error] DDE Face Tracker Socket Error: " << _udpSocket.errorString();
qCDebug(interface) << "[Error] DDE Face Tracker Socket Error: " << _udpSocket.errorString();
}
void DdeFaceTracker::socketStateChanged(QAbstractSocket::SocketState socketState) {
@ -203,7 +205,7 @@ void DdeFaceTracker::socketStateChanged(QAbstractSocket::SocketState socketState
state = "Unconnected";
break;
}
qDebug() << "[Info] DDE Face Tracker Socket: " << state;
qCDebug(interface) << "[Info] DDE Face Tracker Socket: " << state;
}
void DdeFaceTracker::readPendingDatagrams() {
@ -297,7 +299,7 @@ void DdeFaceTracker::decodePacket(const QByteArray& buffer) {
}
} else {
qDebug() << "[Error] DDE Face Tracker Decode Error";
qCDebug(interface) << "[Error] DDE Face Tracker Decode Error";
}
_lastReceiveTimestamp = usecTimestampNow();
}

View file

@ -18,6 +18,7 @@
#include "Faceshift.h"
#include "Menu.h"
#include "Util.h"
#include "InterfaceLogging.h"
#ifdef HAVE_FACESHIFT
using namespace fs;
@ -134,7 +135,7 @@ void Faceshift::setTCPEnabled(bool enabled) {
void Faceshift::connectSocket() {
if (_tcpEnabled) {
if (!_tcpRetryCount) {
qDebug("Faceshift: Connecting...");
qCDebug(interface, "Faceshift: Connecting...");
}
_tcpSocket.connectToHost(_hostname.get(), FACESHIFT_PORT);
@ -144,7 +145,7 @@ void Faceshift::connectSocket() {
void Faceshift::noteConnected() {
#ifdef HAVE_FACESHIFT
qDebug("Faceshift: Connected.");
qCDebug(interface, "Faceshift: Connected.");
// request the list of blendshape names
string message;
fsBinaryStream::encode_message(message, fsMsgSendBlendshapeNames());
@ -155,7 +156,7 @@ void Faceshift::noteConnected() {
void Faceshift::noteError(QAbstractSocket::SocketError error) {
if (!_tcpRetryCount) {
// Only spam log with fail to connect the first time, so that we can keep waiting for server
qDebug() << "Faceshift: " << _tcpSocket.errorString();
qCDebug(interface) << "Faceshift: " << _tcpSocket.errorString();
}
// retry connection after a 2 second delay
if (_tcpEnabled) {

View file

@ -11,6 +11,7 @@
#include <QtCore/QDebug>
#include "InterfaceLogging.h"
#include "MIDIManager.h"
MIDIManager& MIDIManager::getInstance() {
@ -54,7 +55,7 @@ void MIDIManager::openDefaultPort() {
_midiInput = new RtMidiIn();
if (_midiInput->getPortCount() > 0) {
qDebug() << "MIDIManager opening port" << DEFAULT_MIDI_PORT;
qCDebug(interface) << "MIDIManager opening port" << DEFAULT_MIDI_PORT;
_midiInput->openPort(DEFAULT_MIDI_PORT);
@ -63,10 +64,10 @@ void MIDIManager::openDefaultPort() {
_midiInput->setCallback(&MIDIManager::midiCallback);
} else {
qDebug() << "MIDIManager openDefaultPort called but there are no ports available.";
qCDebug(interface) << "MIDIManager openDefaultPort called but there are no ports available.";
delete _midiInput;
_midiInput = NULL;
}
}
#endif
}
}

View file

@ -32,6 +32,7 @@
#include <OVR_CAPI_GL.h>
#include "InterfaceLogging.h"
#include "Application.h"
template <typename Function>
@ -128,7 +129,7 @@ void OculusManager::connect() {
initSdk();
#endif
_calibrationState = UNCALIBRATED;
qDebug() << "Oculus SDK" << OVR_VERSION_STRING;
qCDebug(interface) << "Oculus SDK" << OVR_VERSION_STRING;
if (_ovrHmd) {
if (!_isConnected) {
UserActivityLogger::getInstance().connectedDevice("hmd", "oculus");
@ -278,7 +279,7 @@ void OculusManager::calibrate(glm::vec3 position, glm::quat orientation) {
_calibrationState = WAITING_FOR_ZERO_HELD;
if (!_calibrationMessage) {
qDebug() << "Hold still to calibrate HMD";
qCDebug(interface) << "Hold still to calibrate HMD";
billboard = new Text3DOverlay();
billboard->setDimensions(glm::vec2(2.0f, 1.25f));
@ -305,7 +306,7 @@ void OculusManager::calibrate(glm::vec3 position, glm::quat orientation) {
&& glm::angle(orientation * glm::inverse(_calibrationOrientation)) < CALIBRATION_ZERO_MAXIMUM_ANGLE) {
if ((usecTimestampNow() - _calibrationStartTime) > CALIBRATION_ZERO_HOLD_TIME) {
_calibrationState = CALIBRATED;
qDebug() << "HMD calibrated";
qCDebug(interface) << "HMD calibrated";
Application::getInstance()->getOverlays().deleteOverlay(_calibrationMessage);
_calibrationMessage = NULL;
Application::getInstance()->resetSensors();
@ -346,7 +347,7 @@ void OculusManager::recalibrate() {
void OculusManager::abandonCalibration() {
_calibrationState = CALIBRATED;
if (_calibrationMessage) {
qDebug() << "Abandoned HMD calibration";
qCDebug(interface) << "Abandoned HMD calibration";
Application::getInstance()->getOverlays().deleteOverlay(_calibrationMessage);
_calibrationMessage = NULL;
}
@ -470,7 +471,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
if (timerActive && timerQuery.isResultAvailable()) {
auto result = timerQuery.waitForResult();
if (result) { qDebug() << "Distortion took " << result << "ns"; };
if (result) { qCDebug(interface) << "Distortion took " << result << "ns"; };
timerActive = false;
}
#endif
@ -683,7 +684,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
if (nonZero)
{
qDebug() << QString().sprintf("M2P Latency: Ren: %4.2fms TWrp: %4.2fms PostPresent: %4.2fms Err: %4.2fms %4.2fms",
qCDebug(interface) << QString().sprintf("M2P Latency: Ren: %4.2fms TWrp: %4.2fms PostPresent: %4.2fms Err: %4.2fms %4.2fms",
latencies[0], latencies[1], latencies[2], latencies[3], latencies[4]);
}
}

View file

@ -18,6 +18,7 @@
#include "SixenseManager.h"
#include "devices/OculusManager.h"
#include "UserActivityLogger.h"
#include "InterfaceLogging.h"
#ifdef HAVE_SIXENSE
@ -108,9 +109,9 @@ void SixenseManager::initialize() {
}
if (_sixenseLibrary->load()){
qDebug() << "Loaded sixense library for hydra support -" << _sixenseLibrary->fileName();
qCDebug(interface) << "Loaded sixense library for hydra support -" << _sixenseLibrary->fileName();
} else {
qDebug() << "Sixense library at" << _sixenseLibrary->fileName() << "failed to load."
qCDebug(interface) << "Sixense library at" << _sixenseLibrary->fileName() << "failed to load."
<< "Continuing without hydra support.";
return;
}
@ -206,7 +207,7 @@ void SixenseManager::update(float deltaTime) {
hand->getPalms().push_back(newPalm);
palm = &(hand->getPalms()[hand->getNumPalms() - 1]);
palm->setSixenseID(data->controller_index);
qDebug("Found new Sixense controller, ID %i", data->controller_index);
qCDebug(interface, "Found new Sixense controller, ID %i", data->controller_index);
}
// Disable the hands (and return to default pose) if both controllers are at base station
@ -364,11 +365,11 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
glm::vec3 zAxis = glm::normalize(glm::cross(xAxis, yAxis));
xAxis = glm::normalize(glm::cross(yAxis, zAxis));
_orbRotation = glm::inverse(glm::quat_cast(glm::mat3(xAxis, yAxis, zAxis)));
qDebug("succeess: sixense calibration");
qCDebug(interface, "succeess: sixense calibration");
}
break;
default:
qDebug("failed: sixense calibration");
qCDebug(interface, "failed: sixense calibration");
break;
}
@ -387,7 +388,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
if (_calibrationState == CALIBRATION_STATE_IDLE) {
float reach = glm::distance(positionLeft, positionRight);
if (reach > 2.0f * MINIMUM_ARM_REACH) {
qDebug("started: sixense calibration");
qCDebug(interface, "started: sixense calibration");
_averageLeft = positionLeft;
_averageRight = positionRight;
_reachLeft = _averageLeft;
@ -420,7 +421,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
_lastDistance = 0.0f;
_reachUp = 0.5f * (_reachLeft + _reachRight);
_calibrationState = CALIBRATION_STATE_Y;
qDebug("success: sixense calibration: left");
qCDebug(interface, "success: sixense calibration: left");
}
}
else if (_calibrationState == CALIBRATION_STATE_Y) {
@ -439,7 +440,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
_lastDistance = 0.0f;
_lockExpiry = now + LOCK_DURATION;
_calibrationState = CALIBRATION_STATE_Z;
qDebug("success: sixense calibration: up");
qCDebug(interface, "success: sixense calibration: up");
}
}
}
@ -461,7 +462,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
if (fabs(_lastDistance) > 0.05f * MINIMUM_ARM_REACH) {
// lock has expired so clamp the data and move on
_calibrationState = CALIBRATION_STATE_COMPLETE;
qDebug("success: sixense calibration: forward");
qCDebug(interface, "success: sixense calibration: forward");
// TODO: it is theoretically possible to detect that the controllers have been
// accidentally switched (left hand is holding right controller) and to swap the order.
}

View file

@ -19,6 +19,7 @@
#include "AddressManager.h"
#include "Application.h"
#include "devices/OculusManager.h"
#include "InterfaceLogging.h"
#ifdef Q_OS_WIN
static BOOL CALLBACK enumWindowsCallback(HWND hWnd, LPARAM lParam) {
@ -91,7 +92,7 @@ int main(int argc, const char* argv[]) {
if (clockSkewOption) {
int clockSkew = atoi(clockSkewOption);
usecTimestampNowForceClockSkew(clockSkew);
qDebug("clockSkewOption=%s clockSkew=%d", clockSkewOption, clockSkew);
qCDebug(interface, "clockSkewOption=%s clockSkew=%d", clockSkewOption, clockSkew);
}
// Oculus initialization MUST PRECEDE OpenGL context creation.
// The nature of the Application constructor means this has to be either here,
@ -107,7 +108,7 @@ int main(int argc, const char* argv[]) {
translator.load("interface_en");
app.installTranslator(&translator);
qDebug( "Created QT Application.");
qCDebug(interface, "Created QT Application.");
exitCode = app.exec();
}
@ -115,6 +116,6 @@ int main(int argc, const char* argv[]) {
ReleaseMutex(mutex);
#endif
qDebug("Normal exit.");
qCDebug(interface, "Normal exit.");
return exitCode;
}

View file

@ -11,6 +11,7 @@
#include <QElapsedTimer>
#include "InterfaceLogging.h"
#include "starfield/Controller.h"
using namespace starfield;
@ -25,7 +26,7 @@ bool Controller::computeStars(unsigned numStars, unsigned seed) {
double NSEC_TO_MSEC = 1.0 / 1000000.0;
double timeDiff = (double)startTime.nsecsElapsed() * NSEC_TO_MSEC;
qDebug() << "Total time to retile and generate stars: " << timeDiff << "msec";
qCDebug(interface) << "Total time to retile and generate stars: " << timeDiff << "msec";
return true;
}

View file

@ -18,6 +18,7 @@
#include <QtCore/QStandardPaths>
#include <QtCore/QVariant>
#include "SharedLogging.h"
#include "HifiConfigVariantMap.h"
QVariantMap HifiConfigVariantMap::mergeCLParametersWithJSONConfig(const QStringList& argumentList) {
@ -132,14 +133,14 @@ void HifiConfigVariantMap::loadMapFromJSONFile(QVariantMap& existingMap, const Q
QFile configFile(filename);
if (configFile.exists()) {
qDebug() << "Reading JSON config file at" << filename;
qCDebug(shared) << "Reading JSON config file at" << filename;
configFile.open(QIODevice::ReadOnly);
QJsonDocument configDocument = QJsonDocument::fromJson(configFile.readAll());
existingMap = configDocument.toVariant().toMap();
} else {
qDebug() << "Could not find JSON config file at" << filename;
qCDebug(shared) << "Could not find JSON config file at" << filename;
}
}

View file

@ -18,6 +18,7 @@
#include "PerfStat.h"
#include "SharedLogging.h"
#include "SharedUtil.h"
// ----------------------------------------------------------------------------
@ -35,20 +36,20 @@ PerformanceWarning::~PerformanceWarning() {
if ((_alwaysDisplay || _renderWarningsOn) && elapsedmsec > 1) {
if (elapsedmsec > 1000) {
double elapsedsec = (end - _start) / 1000000.0;
qDebug("%s took %.2lf seconds %s", _message, elapsedsec, (_alwaysDisplay ? "" : "WARNING!") );
qCDebug(shared, "%s took %.2lf seconds %s", _message, elapsedsec, (_alwaysDisplay ? "" : "WARNING!") );
} else {
if (_suppressShortTimings) {
if (elapsedmsec > 10) {
qDebug("%s took %.1lf milliseconds %s", _message, elapsedmsec,
qCDebug(shared, "%s took %.1lf milliseconds %s", _message, elapsedmsec,
(_alwaysDisplay || (elapsedmsec < 10) ? "" : "WARNING!"));
}
} else {
qDebug("%s took %.2lf milliseconds %s", _message, elapsedmsec,
qCDebug(shared, "%s took %.2lf milliseconds %s", _message, elapsedmsec,
(_alwaysDisplay || (elapsedmsec < 10) ? "" : "WARNING!"));
}
}
} else if (_alwaysDisplay) {
qDebug("%s took %.2lf milliseconds", _message, elapsedmsec);
qCDebug(shared, "%s took %.2lf milliseconds", _message, elapsedmsec);
}
// if the caller gave us a pointer to store the running total, track it now.
if (_runningTotal) {
@ -120,7 +121,7 @@ void PerformanceTimer::dumpAllTimerRecords() {
QMapIterator<QString, PerformanceTimerRecord> i(_records);
while (i.hasNext()) {
i.next();
qDebug() << i.key() << ": average " << i.value().getAverage()
qCDebug(shared) << i.key() << ": average " << i.value().getAverage()
<< " [" << i.value().getMovingAverage() << "]"
<< "usecs over" << i.value().getCount() << "calls";
}

View file

@ -16,6 +16,7 @@
#include "PathUtils.h"
#include "SettingInterface.h"
#include "SettingManager.h"
#include "SharedLogging.h"
namespace Setting {
static Manager* privateInstance = nullptr;
@ -58,7 +59,7 @@ namespace Setting {
QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
privateInstance->moveToThread(thread);
thread->start();
qDebug() << "Settings thread started.";
qCDebug(shared) << "Settings thread started.";
// Register cleanupPrivateInstance to run inside QCoreApplication's destructor.
qAddPostRoutine(cleanupPrivateInstance);
@ -104,4 +105,4 @@ namespace Setting {
privateInstance->loadSetting(this);
}
}
}
}

View file

@ -0,0 +1,14 @@
//
// SharedLogging.h
// libraries/shared/src
//
// Created by Seth Alves on 4/6/15.
// 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
//
#include "SharedLogging.h"
Q_LOGGING_CATEGORY(shared, "hifi.shared")

View file

@ -0,0 +1,14 @@
//
// SharedLogging.h
// libraries/shared/src
//
// Created by Seth Alves on 4/6/15.
// 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
//
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(shared)

View file

@ -30,6 +30,7 @@
#include <QThread>
#include "OctalCode.h"
#include "SharedLogging.h"
#include "SharedUtil.h"
static int usecTimestampNowAdjust = 0; // in usec
@ -65,14 +66,14 @@ quint64 usecTimestampNow(bool wantDebug) {
now = TIME_REFERENCE + ::usecTimestampNowAdjust;
if (wantDebug) {
qDebug() << "usecTimestampNow() - resetting QElapsedTimer. ";
qDebug() << " msecsCurrentTime:" << msecsCurrentTime;
qDebug() << " msecsEstimate:" << msecsEstimate;
qDebug() << " possibleSkew:" << possibleSkew;
qDebug() << " TOLERANCE:" << TOLERANCE;
qCDebug(shared) << "usecTimestampNow() - resetting QElapsedTimer. ";
qCDebug(shared) << " msecsCurrentTime:" << msecsCurrentTime;
qCDebug(shared) << " msecsEstimate:" << msecsEstimate;
qCDebug(shared) << " possibleSkew:" << possibleSkew;
qCDebug(shared) << " TOLERANCE:" << TOLERANCE;
qDebug() << " nsecsElapsed:" << nsecsElapsed;
qDebug() << " usecsElapsed:" << usecsElapsed;
qCDebug(shared) << " nsecsElapsed:" << nsecsElapsed;
qCDebug(shared) << " usecsElapsed:" << usecsElapsed;
QDateTime currentLocalTime = QDateTime::currentDateTime();
@ -80,11 +81,11 @@ quint64 usecTimestampNow(bool wantDebug) {
QDateTime nowAsString;
nowAsString.setMSecsSinceEpoch(msecsNow);
qDebug() << " now:" << now;
qDebug() << " msecsNow:" << msecsNow;
qCDebug(shared) << " now:" << now;
qCDebug(shared) << " msecsNow:" << msecsNow;
qDebug() << " nowAsString:" << nowAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
qDebug() << " currentLocalTime:" << currentLocalTime.toString("yyyy-MM-dd hh:mm:ss.zzz");
qCDebug(shared) << " nowAsString:" << nowAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
qCDebug(shared) << " currentLocalTime:" << currentLocalTime.toString("yyyy-MM-dd hh:mm:ss.zzz");
}
} else {
now = TIME_REFERENCE + usecsElapsed + ::usecTimestampNowAdjust;
@ -101,16 +102,16 @@ quint64 usecTimestampNow(bool wantDebug) {
QDateTime timeReferenceAsString;
timeReferenceAsString.setMSecsSinceEpoch(msecsTimeReference);
qDebug() << "usecTimestampNow() - details... ";
qDebug() << " TIME_REFERENCE:" << TIME_REFERENCE;
qDebug() << " timeReferenceAsString:" << timeReferenceAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
qDebug() << " usecTimestampNowAdjust:" << usecTimestampNowAdjust;
qDebug() << " nsecsElapsed:" << nsecsElapsed;
qDebug() << " usecsElapsed:" << usecsElapsed;
qDebug() << " now:" << now;
qDebug() << " msecsNow:" << msecsNow;
qDebug() << " nowAsString:" << nowAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
qDebug() << " currentLocalTime:" << currentLocalTime.toString("yyyy-MM-dd hh:mm:ss.zzz");
qCDebug(shared) << "usecTimestampNow() - details... ";
qCDebug(shared) << " TIME_REFERENCE:" << TIME_REFERENCE;
qCDebug(shared) << " timeReferenceAsString:" << timeReferenceAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
qCDebug(shared) << " usecTimestampNowAdjust:" << usecTimestampNowAdjust;
qCDebug(shared) << " nsecsElapsed:" << nsecsElapsed;
qCDebug(shared) << " usecsElapsed:" << usecsElapsed;
qCDebug(shared) << " now:" << now;
qCDebug(shared) << " msecsNow:" << msecsNow;
qCDebug(shared) << " nowAsString:" << nowAsString.toString("yyyy-MM-dd hh:mm:ss.zzz");
qCDebug(shared) << " currentLocalTime:" << currentLocalTime.toString("yyyy-MM-dd hh:mm:ss.zzz");
}
return now;
@ -427,16 +428,16 @@ unsigned char* pointToVoxel(float x, float y, float z, float s, unsigned char r,
void printVoxelCode(unsigned char* voxelCode) {
unsigned char octets = voxelCode[0];
unsigned int voxelSizeInBits = octets*3;
unsigned int voxelSizeInBytes = (voxelSizeInBits/8)+1;
unsigned int voxelSizeInOctets = (voxelSizeInBits/3);
unsigned int voxelBufferSize = voxelSizeInBytes+1+3; // 1 for size, 3 for color
unsigned int voxelSizeInBits = octets*3;
unsigned int voxelSizeInBytes = (voxelSizeInBits/8)+1;
unsigned int voxelSizeInOctets = (voxelSizeInBits/3);
unsigned int voxelBufferSize = voxelSizeInBytes+1+3; // 1 for size, 3 for color
qDebug("octets=%d",octets);
qDebug("voxelSizeInBits=%d",voxelSizeInBits);
qDebug("voxelSizeInBytes=%d",voxelSizeInBytes);
qDebug("voxelSizeInOctets=%d",voxelSizeInOctets);
qDebug("voxelBufferSize=%d",voxelBufferSize);
qCDebug(shared, "octets=%d",octets);
qCDebug(shared, "voxelSizeInBits=%d",voxelSizeInBits);
qCDebug(shared, "voxelSizeInBytes=%d",voxelSizeInBytes);
qCDebug(shared, "voxelSizeInOctets=%d",voxelSizeInOctets);
qCDebug(shared, "voxelBufferSize=%d",voxelBufferSize);
for(unsigned int i=0; i < voxelBufferSize; i++) {
QDebug voxelBufferDebug = qDebug();

View file

@ -10,6 +10,7 @@
//
#include <QDebug>
#include "SharedLogging.h"
#include "VariantMapToScriptValue.h"
QScriptValue variantMapToScriptValue(QVariantMap& variantMap, QScriptEngine& scriptEngine) {
@ -39,7 +40,7 @@ QScriptValue variantMapToScriptValue(QVariantMap& variantMap, QScriptEngine& scr
break;
}
default:
qDebug() << "unhandled QScript type" << qValue.type();
qCDebug(shared) << "unhandled QScript type" << qValue.type();
}
}

View file

@ -69,6 +69,7 @@
#include <e32std.h>
#endif
#include "SharedLogging.h"
/*!
@ -740,7 +741,7 @@ bool QTimeSpan::parts(int *msecondsPtr,
QDate newStartDate(startDate);
newStartDate = newStartDate.addYears(*_years);
newStartDate = newStartDate.addMonths(*_months);
//qDebug() << "working with new start date" << newStartDate << "and end date" << endDate;
//qCDebug(shared) << "working with new start date" << newStartDate << "and end date" << endDate;
ts = QDateTime(endDate, ts.endDate().time()) - QDateTime(newStartDate, ts.startDate().time());
*_months = totalMonths;
@ -756,7 +757,7 @@ bool QTimeSpan::parts(int *msecondsPtr,
//from here on, we use ts as the time span!
qint64 intervalLeft = ts.toMSecs();
qint64 unitFactor;
//qDebug() << "intervalLeft" << intervalLeft;
//qCDebug(shared) << "intervalLeft" << intervalLeft;
if (weeksPtr) {
unitFactor = (7 * 24 * 60 * 60 * 1000);
CHECK_INT_LIMIT(intervalLeft, unitFactor)
@ -1089,8 +1090,8 @@ bool QTimeSpan::operator<=(const QTimeSpan &other) const
\code
QTimeSpan s1 = 2 * QTimeSpan::Day;
QTimeSpan s2 = -2 * QTimeSpan::Day;
qDebug() << s1.matchesLength(s2); //returns false
qDebug() << s1.matchesLength(s2, true); //returns true
qCDebug(shared) << s1.matchesLength(s2); //returns false
qCDebug(shared) << s1.matchesLength(s2, true); //returns true
\endcode
*/
bool QTimeSpan::matchesLength(const QTimeSpan &other, bool normalize) const
@ -2060,7 +2061,7 @@ QString QTimeSpan::toApproximateString(int suppresSecondUnitLimit, Qt::TimeSpanF
bool result = partsHash.fill(*this);
if (!result) {
qDebug() << "false result from parts function";
qCDebug(shared) << "false result from parts function";
return QString();
}
@ -2214,7 +2215,7 @@ QTimeSpan QTimeSpan::fromString(const QString &string, const QString &format, co
it.next();
if (it.value()) {
span.d->addUnit(&span, it.key(), *(it.value()));
qDebug() << "Added unit" << it.key() << "with value" << *(it.value()) << "new value" << span.d->interval;
qCDebug(shared) << "Added unit" << it.key() << "with value" << *(it.value()) << "new value" << span.d->interval;
}
}