From 8fb8011e6ac6352cf60cdd59d840779f0d9c52a6 Mon Sep 17 00:00:00 2001 From: Berthold Krevert Date: Wed, 8 Aug 2012 18:38:37 +0200 Subject: Make Qt compile with -DQDND_DEBUG and fix debug messages Change-Id: Idf34880179e27cdd48ea3365108d2c7bca07e596 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qdnd.cpp | 56 -------------------------------------- src/gui/kernel/qplatformdrag.cpp | 59 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 59 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp index a97583b4ef..bb1d0a1c60 100644 --- a/src/gui/kernel/qdnd.cpp +++ b/src/gui/kernel/qdnd.cpp @@ -68,62 +68,6 @@ 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; diff --git a/src/gui/kernel/qplatformdrag.cpp b/src/gui/kernel/qplatformdrag.cpp index 068dfabf7b..a4d8465ca2 100644 --- a/src/gui/kernel/qplatformdrag.cpp +++ b/src/gui/kernel/qplatformdrag.cpp @@ -49,6 +49,59 @@ 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; -- cgit v1.2.3