summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2019-10-07 09:36:13 +0300
committerAntti Määttä <antti.maatta@qt.io>2019-10-07 11:00:24 +0300
commitda8d2d55ccc3edd28ef3e77de46dae255282a46b (patch)
tree39dac8f97de6c531ad849165dcd7b208c750e5fc
parent0582de9c1063ec5d83f3ee931925e1d8a276d3b6 (diff)
Use logging categories with all debug messages
Task-number: QT3DS-3712 Change-Id: Ibb751d2ad462685f0ba39cef6a4d932708faac57 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/api/studio3d/studio3d.pro3
-rw-r--r--src/dm/systems/Qt3DSDMValue.cpp8
-rw-r--r--src/foundation/qt/formatdiscovery.cpp10
-rw-r--r--src/runtime/Qt3DSApplication.cpp27
4 files changed, 20 insertions, 28 deletions
diff --git a/src/api/studio3d/studio3d.pro b/src/api/studio3d/studio3d.pro
index 6749a57..f0cd874 100644
--- a/src/api/studio3d/studio3d.pro
+++ b/src/api/studio3d/studio3d.pro
@@ -51,7 +51,8 @@ SOURCES += q3dsdataoutput.cpp \
q3dsimagesequencegenerator.cpp \
q3dsimagesequencegeneratorthread.cpp \
q3dsdatainput.cpp \
- q3dsgeometry.cpp
+ q3dsgeometry.cpp \
+ ../../foundation/Qt3DSLogging.cpp
# Platform specific surface format discovery functions
#TODO: QT3DS-3608 Implement OpenGL version discovery for Windows
diff --git a/src/dm/systems/Qt3DSDMValue.cpp b/src/dm/systems/Qt3DSDMValue.cpp
index 57ba400..48267c8 100644
--- a/src/dm/systems/Qt3DSDMValue.cpp
+++ b/src/dm/systems/Qt3DSDMValue.cpp
@@ -28,6 +28,7 @@
****************************************************************************/
#include "Qt3DSDMPrefix.h"
#include "Qt3DSDMValue.h"
+#include "foundation/Qt3DSLogging.h"
#include <QtGui/qcolor.h>
#include <QtCore/qdebug.h>
@@ -91,7 +92,7 @@ SValue::SValue(const QVariant &inData)
break;
}
default:
- qDebug() << "Add a handler for QVariant::type" << inData.type();
+ qCWarning(qt3ds::WARNING) << "Add a handler for QVariant::type" << inData.type();
throw std::runtime_error("Cannot transform this QVariant into SValue");
}
}
@@ -124,7 +125,7 @@ QVariant SValue::toQVariant() const
}
case DataModelDataType::FloatList: {
//KDAB_TODO
- qDebug() << "Add a handler for type DataModelDataType::FloatList";
+ qCWarning(qt3ds::WARNING) << "Add a handler for type DataModelDataType::FloatList";
return {};
}
case DataModelDataType::Long4: {
@@ -135,13 +136,10 @@ QVariant SValue::toQVariant() const
switch (theRef.GetReferenceType()) {
case ObjectReferenceType::Absolute:
return SValue(get<SLong4>(theRef.m_Value)).toQVariant();
- break;
case ObjectReferenceType::Relative:
return SValue(get<TDataStrPtr>(theRef.m_Value)).toQVariant();
- break;
case ObjectReferenceType::Unknown:
return QVariant::fromValue(QVector<qt3ds::QT3DSU32>());
- break;
}
}
case DataModelDataType::StringOrInt: {
diff --git a/src/foundation/qt/formatdiscovery.cpp b/src/foundation/qt/formatdiscovery.cpp
index 0a4bcbd..db1e470 100644
--- a/src/foundation/qt/formatdiscovery.cpp
+++ b/src/foundation/qt/formatdiscovery.cpp
@@ -49,7 +49,7 @@ static QSurfaceFormat findIdealGLVersion()
QOpenGLContext ctx;
ctx.setFormat(fmt);
if (ctx.create() && ctx.format().version() >= qMakePair(4, 3)) {
- qDebug("Requesting OpenGL 4.3 core context succeeded");
+ qCInfo(qt3ds::TRACE_INFO) << "Requesting OpenGL 4.3 core context succeeded";
return ctx.format();
}
@@ -57,7 +57,7 @@ static QSurfaceFormat findIdealGLVersion()
fmt.setVersion(3, 3);
ctx.setFormat(fmt);
if (ctx.create() && ctx.format().version() >= qMakePair(3, 3)) {
- qDebug("Requesting OpenGL 3.3 core context succeeded");
+ qCInfo(qt3ds::TRACE_INFO) << "Requesting OpenGL 3.3 core context succeeded";
return ctx.format();
}
@@ -80,7 +80,7 @@ static QSurfaceFormat findIdealGLESVersion()
// support and return a 3.0 context. This is against the spec since 3.0 is
// obviously not backwards compatible with 3.1, but hey...
if (ctx.create() && ctx.format().version() >= qMakePair(3, 1)) {
- qDebug("Requesting OpenGL ES 3.1 context succeeded");
+ qCInfo(qt3ds::TRACE_INFO) << "Requesting OpenGL ES 3.1 context succeeded";
return ctx.format();
}
@@ -89,14 +89,14 @@ static QSurfaceFormat findIdealGLESVersion()
fmt.setVersion(3, 0);
ctx.setFormat(fmt);
if (ctx.create() && ctx.format().version() >= qMakePair(3, 0)) {
- qDebug("Requesting OpenGL ES 3.0 context succeeded");
+ qCInfo(qt3ds::TRACE_INFO) << "Requesting OpenGL ES 3.0 context succeeded";
return ctx.format();
}
fmt.setVersion(2, 0);
ctx.setFormat(fmt);
if (ctx.create()) {
- qDebug("Requesting OpenGL ES 2.0 context succeeded");
+ qCInfo(qt3ds::TRACE_INFO) << "Requesting OpenGL ES 2.0 context succeeded";
return fmt;
}
diff --git a/src/runtime/Qt3DSApplication.cpp b/src/runtime/Qt3DSApplication.cpp
index abe93c8..e8ed57e 100644
--- a/src/runtime/Qt3DSApplication.cpp
+++ b/src/runtime/Qt3DSApplication.cpp
@@ -221,13 +221,6 @@ struct SHandleElementPairComparator
static int s_debug = -1;
-static bool debuggingEnabled()
-{
- if (s_debug == -1)
- s_debug = qEnvironmentVariableIntValue("QT3DS_DEBUG");
- return s_debug >= 1;
-}
-
struct SSlideResourceCounter
{
QHash<QString, int> counters;
@@ -295,20 +288,20 @@ struct SSlideResourceCounter
}
void print()
{
- if (debuggingEnabled()) {
- qDebug() << "SlideResourceCounter resources:";
+ if (qt3ds::TRACE_INFO().isInfoEnabled()) {
+ qCInfo(qt3ds::TRACE_INFO) << "SlideResourceCounter resources:";
const auto keys = counters.keys();
for (auto &x : keys)
- qDebug() << x << ": " << counters[x];
+ qCInfo(qt3ds::TRACE_INFO) << x << ": " << counters[x];
if (createSet.size()) {
- qDebug() << "New resources: ";
+ qCInfo(qt3ds::TRACE_INFO) << "New resources: ";
for (auto y : qAsConst(createSet))
- qDebug() << y;
+ qCInfo(qt3ds::TRACE_INFO) << y;
}
if (deleteSet.size()) {
- qDebug() << "Deleted resources: ";
+ qCInfo(qt3ds::TRACE_INFO) << "Deleted resources: ";
for (auto y : qAsConst(deleteSet))
- qDebug() << y;
+ qCInfo(qt3ds::TRACE_INFO) << y;
}
}
}
@@ -1220,7 +1213,7 @@ struct SApp : public IApplication
slidesystem.setUnloadSlide(key, false);
const QString completeName = presentation->GetName() + QLatin1Char(':')
+ QString::fromUtf8(key.m_Component->m_Name) + QLatin1Char(':') + slideName;
- qCInfo(PERF_INFO) << "Load component slide resources: " << completeName;
+ qCInfo(TRACE_INFO) << "Load component slide resources: " << completeName;
m_resourceCounter.handleLoadSlide(completeName, key, slidesystem);
if (m_uploadRenderTask)
m_uploadRenderTask->add(m_resourceCounter.createSet, wait);
@@ -1231,7 +1224,7 @@ struct SApp : public IApplication
getComponentSlideAssets(newAssets, presentation, component, index);
if (newAssets.size())
- qCInfo(PERF_INFO) << "Slide assets: " << newAssets;
+ qCInfo(TRACE_INFO) << "Slide assets: " << newAssets;
for (QT3DSU32 idx = 0, end = m_OrderedAssets.size(); idx < end; ++idx) {
QString assetId = QString::fromUtf8(m_OrderedAssets[idx].first.c_str());
if (newAssets.contains(assetId) && !GetPresentationById(qUtf8Printable(assetId))) {
@@ -1292,7 +1285,7 @@ struct SApp : public IApplication
if (!slidesystem.isActiveSlide(key)) {
const QString completeName = presentation->GetName() + QLatin1Char(':')
+ QString::fromUtf8(key.m_Component->m_Name) + QLatin1Char(':') + slideName;
- qCInfo(PERF_INFO) << "Unload component slide resources: " << completeName;
+ qCInfo(TRACE_INFO) << "Unload component slide resources: " << completeName;
m_resourceCounter.handleUnloadSlide(completeName, key, slidesystem);
if (m_uploadRenderTask)