Make Qt compile with -DQDND_DEBUG and fix debug messages
authorBerthold Krevert <berthold.krevert@basyskom.com>
Wed, 8 Aug 2012 16:38:37 +0000 (18:38 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 22 Aug 2012 07:08:02 +0000 (09:08 +0200)
Change-Id: Idf34880179e27cdd48ea3365108d2c7bca07e596
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
src/gui/kernel/qdnd.cpp
src/gui/kernel/qplatformdrag.cpp

index a97583b..bb1d0a1 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-//#define QDND_DEBUG
-
-#ifdef QDND_DEBUG
-QString dragActionsToString(Qt::DropActions actions)
-{
-    QString str;
-    if (actions == Qt::IgnoreAction) {
-        if (!str.isEmpty())
-            str += " | ";
-        str += "IgnoreAction";
-    }
-    if (actions & Qt::LinkAction) {
-        if (!str.isEmpty())
-            str += " | ";
-        str += "LinkAction";
-    }
-    if (actions & Qt::CopyAction) {
-        if (!str.isEmpty())
-            str += " | ";
-        str += "CopyAction";
-    }
-    if (actions & Qt::MoveAction) {
-        if (!str.isEmpty())
-            str += " | ";
-        str += "MoveAction";
-    }
-    if ((actions & Qt::TargetMoveAction) == Qt::TargetMoveAction ) {
-        if (!str.isEmpty())
-            str += " | ";
-        str += "TargetMoveAction";
-    }
-    return str;
-}
-
-QString KeyboardModifiersToString(Qt::KeyboardModifiers moderfies)
-{
-    QString str;
-    if (moderfies & Qt::ControlModifier) {
-        if (!str.isEmpty())
-            str += " | ";
-        str += Qt::ControlModifier;
-    }
-    if (moderfies & Qt::AltModifier) {
-        if (!str.isEmpty())
-            str += " | ";
-        str += Qt::AltModifier;
-    }
-    if (moderfies & Qt::ShiftModifier) {
-        if (!str.isEmpty())
-            str += " | ";
-        str += Qt::ShiftModifier;
-    }
-    return str;
-}
-#endif
-
 // the universe's only drag manager
 QDragManager *QDragManager::m_instance = 0;
 
index 068dfab..a4d8465 100644 (file)
 QT_BEGIN_NAMESPACE
 
 #ifndef QT_NO_DRAGANDDROP
+#ifdef QDND_DEBUG
+QString dragActionsToString(Qt::DropActions actions)
+{
+    QString str;
+    if (actions == Qt::IgnoreAction) {
+        if (!str.isEmpty())
+            str += QLatin1String(" | ");
+        str += QLatin1String("IgnoreAction");
+    }
+    if (actions & Qt::LinkAction) {
+        if (!str.isEmpty())
+            str += QLatin1String(" | ");
+        str += QLatin1String("LinkAction");
+    }
+    if (actions & Qt::CopyAction) {
+        if (!str.isEmpty())
+            str += QLatin1String(" | ");
+        str += QLatin1String("CopyAction");
+    }
+    if (actions & Qt::MoveAction) {
+        if (!str.isEmpty())
+            str += QLatin1String(" | ");
+        str += QLatin1String("MoveAction");
+    }
+    if ((actions & Qt::TargetMoveAction) == Qt::TargetMoveAction ) {
+        if (!str.isEmpty())
+            str += QLatin1String(" | ");
+        str += QLatin1String("TargetMoveAction");
+    }
+    return str;
+}
+
+QString KeyboardModifiersToString(Qt::KeyboardModifiers modifiers)
+{
+    QString str;
+    if (modifiers & Qt::ControlModifier) {
+        if (!str.isEmpty())
+            str += QLatin1String(" | ");
+        str += QLatin1String("ControlModifier");
+    }
+    if (modifiers & Qt::AltModifier) {
+        if (!str.isEmpty())
+            str += QLatin1String(" | ");
+        str += QLatin1String("AltModifier");
+    }
+    if (modifiers & Qt::ShiftModifier) {
+        if (!str.isEmpty())
+            str += QLatin1String(" | ");
+        str += QLatin1String("ShiftModifier");
+    }
+    return str;
+}
+#endif
 
 QPlatformDropQtResponse::QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction)
     : m_accepted(accepted)
@@ -112,7 +165,7 @@ Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
 {
 #ifdef QDND_DEBUG
     qDebug("QDragManager::defaultAction(Qt::DropActions possibleActions)");
-    qDebug("keyboard modifiers : %s", KeyboardModifiersToString(modifiers).latin1());
+    qDebug("keyboard modifiers : %s", qPrintable(KeyboardModifiersToString(modifiers)));
 #endif
 
     Qt::DropAction default_action = Qt::IgnoreAction;
@@ -138,7 +191,7 @@ Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
         default_action = Qt::LinkAction;
 
 #ifdef QDND_DEBUG
-    qDebug("possible actions : %s", dragActionsToString(possibleActions).latin1());
+    qDebug("possible actions : %s", qPrintable(dragActionsToString(possibleActions)));
 #endif
 
     // Check if the action determined is allowed
@@ -154,7 +207,7 @@ Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
     }
 
 #ifdef QDND_DEBUG
-    qDebug("default action : %s", dragActionsToString(defaultAction).latin1());
+    qDebug("default action : %s", qPrintable(dragActionsToString(default_action)));
 #endif
 
     return default_action;