Debugger: Add QML_DEBUGGER_VERBOSE environment variable
authorKai Koehne <kai.koehne@nokia.com>
Mon, 31 Oct 2011 13:40:37 +0000 (14:40 +0100)
committerQt by Nokia <qt-info@nokia.com>
Tue, 1 Nov 2011 16:04:09 +0000 (17:04 +0100)
Print detailed information about plugin loading when QML_DEBUGGER_VERBOSE
is set in the environment.

Change-Id: I48b9df01948b2cd226969cfbc520801527ff5492
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
src/declarative/debugger/qdeclarativedebugserver.cpp
src/declarative/debugger/qdeclarativeinspectorservice.cpp

index 5a888c7..a4f5bd2 100644 (file)
@@ -77,6 +77,8 @@ QT_BEGIN_NAMESPACE
 
 const int protocolVersion = 1;
 
+// print detailed information about loading of plugins
+DEFINE_BOOL_CONFIG_OPTION(qmlDebugVerbose, QML_DEBUGGER_VERBOSE)
 
 class QDeclarativeDebugServerPrivate : public QObjectPrivate
 {
@@ -137,16 +139,29 @@ QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectio
     }
 
     foreach (const QString &pluginPath, pluginCandidates) {
+        if (qmlDebugVerbose())
+            qDebug() << "QDeclarativeDebugServer: Trying to load plugin " << pluginPath << "...";
+
         QPluginLoader loader(pluginPath);
         if (!loader.load()) {
+            if (qmlDebugVerbose())
+                qDebug() << "QDeclarativeDebugServer: Error while loading: " << loader.errorString();
             continue;
         }
         QDeclarativeDebugServerConnection *connection = 0;
         if (QObject *instance = loader.instance())
             connection = qobject_cast<QDeclarativeDebugServerConnection*>(instance);
 
-        if (connection)
+        if (connection) {
+            if (qmlDebugVerbose())
+                qDebug() << "QDeclarativeDebugServer: Plugin successfully loaded.";
+
             return connection;
+        }
+
+        if (qmlDebugVerbose())
+            qDebug() << "QDeclarativeDebugServer: Plugin does not implement interface QDeclarativeDebugServerConnection.";
+
         loader.unload();
     }
 #endif
index d6fdaa5..c3f90d2 100644 (file)
@@ -48,6 +48,9 @@
 #include <QtCore/QDir>
 #include <QtCore/QPluginLoader>
 
+// print detailed information about loading of plugins
+DEFINE_BOOL_CONFIG_OPTION(qmlDebugVerbose, QML_DEBUGGER_VERBOSE)
+
 QT_BEGIN_NAMESPACE
 
 Q_GLOBAL_STATIC(QDeclarativeInspectorService, serviceInstance)
@@ -115,6 +118,10 @@ void QDeclarativeInspectorService::updateStatus()
             }
         }
 
+        if (!m_currentInspectorPlugin) {
+            qWarning() << "QDeclarativeInspector: No plugin available for view '" << m_views.first()->metaObject()->className() << "'.";
+            return;
+        }
         m_currentInspectorPlugin->activate(m_views.first());
     } else {
         if (m_currentInspectorPlugin) {
@@ -142,16 +149,29 @@ void QDeclarativeInspectorService::loadInspectorPlugins()
     }
 
     foreach (const QString &pluginPath, pluginCandidates) {
+        if (qmlDebugVerbose())
+            qDebug() << "QDeclarativeInspector: Trying to load plugin " << pluginPath << "...";
+
         QPluginLoader loader(pluginPath);
-        if (!loader.load())
+        if (!loader.load()) {
+            if (qmlDebugVerbose())
+                qDebug() << "QDeclarativeInspector: Error while loading: " << loader.errorString();
+
             continue;
+        }
 
         QDeclarativeInspectorInterface *inspector =
                 qobject_cast<QDeclarativeInspectorInterface*>(loader.instance());
-        if (inspector)
+        if (inspector) {
+            if (qmlDebugVerbose())
+                qDebug() << "QDeclarativeInspector: Plugin successfully loaded.";
             m_inspectorPlugins << inspector;
-        else
+        } else {
+            if (qmlDebugVerbose())
+                qDebug() << "QDeclarativeInspector: Plugin does not implement interface QDeclarativeInspectorInterface.";
+
             loader.unload();
+        }
     }
 }