From 6340b8737348c50a68f1fd329716b2e5e5862f87 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 14 Nov 2009 22:17:07 +0000 Subject: [PATCH] 2009-11-14 23:16 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/hbqt.ch * contrib/hbqt/tests/demoqt.prg + Changed to use same .prg level debug trace call method as in hbxbp. Enable it with __HB_OUTDEBUG__. On Windows to use OutputDebugString() instead of regular Harbour trace calls, also #define __HB_WINDEBUG__. In this case, also link hbwin lib (not xhb lib). * Moved QT_PTROF() macro from demo code to header. --- harbour/ChangeLog | 10 ++++++++++ harbour/contrib/hbqt/hbqt.ch | 12 ++++++++++++ harbour/contrib/hbqt/tests/demoqt.prg | 26 +++++++++----------------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0f942522a2..b1c831158e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,16 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-11-14 23:16 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/hbqt.ch + * contrib/hbqt/tests/demoqt.prg + + Changed to use same .prg level debug trace call method as in hbxbp. + Enable it with __HB_OUTDEBUG__. + On Windows to use OutputDebugString() instead of regular Harbour + trace calls, also #define __HB_WINDEBUG__. In this case, also link + hbwin lib (not xhb lib). + * Moved QT_PTROF() macro from demo code to header. + 2009-11-14 12:16 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/tests/demoqt.prg ! Fixed to excluse non-working components and streamlined hb_toOutDebug(). diff --git a/harbour/contrib/hbqt/hbqt.ch b/harbour/contrib/hbqt/hbqt.ch index 19d40b2c49..68d4a89993 100644 --- a/harbour/contrib/hbqt/hbqt.ch +++ b/harbour/contrib/hbqt/hbqt.ch @@ -67,6 +67,18 @@ #ifndef _HBQT_CH +#if defined( __HB_OUTDEBUG__ ) + #if defined( __PLATFORM__WINDOWS ) .AND. defined( __HB_WINDEBUG__ ) + #xtranslate HB_OUTDEBUG( [] ) => wapi_OutputDebugString( ) + #else + #xtranslate HB_OUTDEBUG( [] ) => hb_TraceString( ) + #endif +#else + #xtranslate HB_OUTDEBUG( [] ) => iif( .T.,, ) +#endif + +#define QT_PTROF( oObj ) ( oObj:pPtr ) + #define QEvent_None 0 // Not an event. #define QEvent_Timer 1 // Regular timer events (QTimerEvent). #define QEvent_MouseButtonPress 2 // Mouse press (QMouseEvent). diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 0489c4daa0..23daf253a7 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -52,7 +52,7 @@ */ /*----------------------------------------------------------------------*/ -#define QT_PTROF( oObj ) ( oObj:pPtr ) +#include "hbqt.ch" #define QT_EVE_TRIGGERED "triggered()" #define QT_EVE_TRIGGERED_B "triggered(bool)" @@ -100,18 +100,10 @@ EXIT PROCEDURE Qt_End() /*----------------------------------------------------------------------*/ FUNCTION My_Events() -q_toOutDebug( "Key Pressed" ) +HB_OUTDEBUG( "Key Pressed" ) RETURN nil /*----------------------------------------------------------------------*/ -#ifdef __PLATFORM__WINDOWS -FUNCTION q_toOutDebug( ... ) - hb_toOutDebug( ... ) - RETURN nil -#else - RETURN nil -#endif -/*----------------------------------------------------------------------*/ PROCEDURE Main() Local oLabel, oBtn, oDA, oWnd, oProg, oSBar, i @@ -122,8 +114,8 @@ PROCEDURE Main() Qt_SetEventFilter() Qt_SetEventSlots() -q_toOutDebug( " " ) -q_toOutDebug( "-----------------b-----------------" ) +HB_OUTDEBUG( " " ) +HB_OUTDEBUG( "-----------------b-----------------" ) FOR i := 1 TO 1 oWnd := QMainWindow():new() @@ -157,17 +149,17 @@ q_toOutDebug( "-----------------b-----------------" ) oProg := Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) aList := Build_ListBox( oDA, { 310,240 }, { 150, 100 } ) -q_toOutDebug( "connected: %s", IF( QT_CONNECT_EVENT( QT_PTROF( oWnd ), 6, {|o,e| My_Events( o, e ) } ), "Yes", "No" ) ) +HB_OUTDEBUG( "connected: " + IIF( QT_CONNECT_EVENT( QT_PTROF( oWnd ), 6, {|o,e| My_Events( o, e ) } ), "Yes", "No" ) ) oWnd:Show() qApp:exec() -q_toOutDebug( "----------------- qApp:exec -----------------" ) +HB_OUTDEBUG( "----------------- qApp:exec -----------------" ) xReleaseMemory( { oBtn, oLabel, oProg, oSBar, aGrid, aList, aMenu, aTool, aTabs, oDA, oWnd } ) -q_toOutDebug( "-------------------- exit -------------------" ) +HB_OUTDEBUG( "-------------------- exit -------------------" ) RETURN @@ -176,7 +168,7 @@ q_toOutDebug( "-------------------- exit -------------------" ) FUNCTION xReleaseMemory( aObj ) #if 1 LOCAL i -q_toOutDebug( "----------------- Releasing Memory -----------------" ) +HB_OUTDEBUG( "----------------- Releasing Memory -----------------" ) FOR i := 1 TO len( aObj ) IF hb_isObject( aObj[ i ] ) aObj[ i ]:pPtr := 1 @@ -184,7 +176,7 @@ q_toOutDebug( "----------------- Releasing Memory -----------------" ) xReleaseMemory( aObj[ i ] ) ENDIF NEXT -q_toOutDebug( "------------------ Memory Released ------------------" ) +HB_OUTDEBUG( "------------------ Memory Released ------------------" ) #else HB_SYMBOL_UNUSED( aObj ) #endif