diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bc1f0b1505..eee7b027f9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,9 +16,40 @@ The license applies to all entries newer than 2009-04-28. */ +2010-09-29 21:22 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qtcore/hbqt.h + ! Deleted declaration for no more existing function hbqt_pPtrFromItem(). + + * contrib/hbqt/qtcore/hbqt_destruct.cpp + % Deleted unused hbqt_gcpointerFromItem() function. + - Deleted __HBQT_SETCODECFORCSTRINGS(), __HBQT_SETCODECFORTR() functions. + + - contrib/hbqt/qtcore/hbqt_base.cpp + + contrib/hbqt/qtcore/hbqt_version.cpp + - contrib/hbqt/qtcore/hbqt_destruct.cpp + + contrib/hbqt/qtcore/hbqt_pointer.cpp + * contrib/hbqt/qtcore/hbqtcore.hbm + * Moved pointer related functions to hbqt_destruct.cpp. + * Renamed sources. + + * contrib/hbqt/qtcore/hbqt_base.cpp + * contrib/hbqt/qtcore/hbqt_destruct.cpp + * contrib/hbqt/qtcore/hbqtcore.hbx + * contrib/hbqt/qtcore/hbqt_misc.prg + + Renamed HBQT_ISEMPTYQTPOINTER() to __HBQT_ISVALIDPOINTER() and optimized a bit. + + HBQT_ISEQUALGCQTPOINTER() rewritten to accept .prg level classes. + Please test! + + Added HBQT_PTR__() as experimental replacement for .prg version HBQT_PTR(). + + * contrib/hbxbp/xbpwindow.prg + + XbpWindow:getHWND() changed to throw RTE. + + * contrib/hbide/hbqreportsmanager.prg + * hbqt_isEmptyQtPointer() replaced with :isValidObject() call. + 2010-09-29 21:20 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt) * harbour/contrib/sddodbc/sddodbc.c - ! fixed getting of empty string value. Thanks David Monta\~no for + ! fixed getting of empty string value. Thanks David Montano for bug report ; Please, test diff --git a/harbour/contrib/hbide/hbqreportsmanager.prg b/harbour/contrib/hbide/hbqreportsmanager.prg index 6a8de0c2fd..e9cc574447 100644 --- a/harbour/contrib/hbide/hbqreportsmanager.prg +++ b/harbour/contrib/hbide/hbqreportsmanager.prg @@ -1829,7 +1829,7 @@ METHOD HqrGraphicsItem:contextMenu( p1, p2 ) qMenu:addAction( "Copy" ) pAct := qMenu:exec( qEvent:screenPos() ) - IF ! hbqt_isEmptyQtPointer( pAct ) + IF pAct:isValidObject() SWITCH ( QAction():configure( pAct ) ):text() CASE "Cut" EXIT diff --git a/harbour/contrib/hbqt/qtcore/hbqt.h b/harbour/contrib/hbqt/qtcore/hbqt.h index cb240ba13c..82f988702e 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt.h +++ b/harbour/contrib/hbqt/qtcore/hbqt.h @@ -88,7 +88,6 @@ HB_EXTERN_BEGIN extern HB_EXPORT void * hbqt_gcpointer( int iParam ); extern HB_EXPORT const HB_GC_FUNCS * hbqt_gcFuncs( void ); extern HB_EXPORT void * hbqt_pPtrFromObj( int iParam ); -extern HB_EXPORT void * hbqt_pPtrFromItem( PHB_ITEM pObj ); HB_EXTERN_END diff --git a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg index 090fa6cf17..2fed69f8c0 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg +++ b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg @@ -76,7 +76,7 @@ CLASS HbQtObjectHandler /*----------------------------------------------------------------------*/ METHOD HbQtObjectHandler:isValidObject() - RETURN ! hbqt_isEmptyQtPointer( ::pPtr ) + RETURN __hbqt_IsValidPointer( ::pPtr ) /*----------------------------------------------------------------------*/ @@ -178,4 +178,3 @@ FUNCTION hbqt_error() RETURN Eval( ErrorBlock(), oError ) /*----------------------------------------------------------------------*/ - diff --git a/harbour/contrib/hbqt/qtcore/hbqt_destruct.cpp b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp similarity index 84% rename from harbour/contrib/hbqt/qtcore/hbqt_destruct.cpp rename to harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp index 0f568067da..1d082921eb 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_destruct.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp @@ -59,8 +59,6 @@ #if QT_VERSION >= 0x040500 -#include - /*----------------------------------------------------------------------*/ static HB_GARBAGE_FUNC( Q_release ) @@ -82,28 +80,6 @@ const HB_GC_FUNCS * hbqt_gcFuncs( void ) return &QT_gcFuncs; } -static void * hbqt_gcpointerFromItem( PHB_ITEM pObj ) -{ - HBQT_GC_T * p; - - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcpointerFromItem( %p )", pObj ) ); - - p = ( HBQT_GC_T * ) hb_itemGetPtrGC( pObj, hbqt_gcFuncs() ); - - if( p && p->ph ) - return p->ph; - else if( hb_itemGetPtr( pObj ) ) - { - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcpointerFromItem(): returns raw pointer: %p", hb_itemGetPtr( pObj ) ) ); - return hb_itemGetPtr( pObj ); /* TOFIX: In what cases is this needed? Reference counting to avoid referring to freed pointers? */ - } - else - { - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcpointerFromItem(): returns NULL" ) ); - return NULL; /* TODO: Still better if RTE. */ - } -} - void * hbqt_par_obj( int iParam ) { PHB_ITEM pItem; @@ -212,16 +188,47 @@ void * hbqt_pPtrFromObj( int iParam ) } } -HB_FUNC( __HBQT_SETCODECFORCSTRINGS ) +/* TOFIX */ +HB_FUNC( HBQT_PTR__ ) { - QTextCodec * codec = QTextCodec::codecForName( ( char * ) hb_parc( 1 ) ); - QTextCodec::setCodecForCStrings( codec ); + PHB_ITEM pObj = hb_param( 1, HB_IT_OBJECT ); + + if( pObj ) + { + PHB_DYNS pPPTR = hb_dynsymFindName( "PPTR" ); + + if( pPPTR ) /* TOFIX: Verify is such message really provided by this object */ + { + hb_vmPushSymbol( hb_dynsymSymbol( pPPTR ) ); + hb_vmPush( pObj ); + hb_vmSend( 0 ); + + hb_itemReturn( hb_param( -1, HB_IT_ANY ) ); + return; + } + } + + hb_itemReturn( hb_param( 1, HB_IT_ANY ) ); } -HB_FUNC( __HBQT_SETCODECFORTR ) +HB_FUNC( __HBQT_ISVALIDPOINTER ) { - QTextCodec * codec = QTextCodec::codecForName( ( char * ) hb_parc( 1 ) ); - QTextCodec::setCodecForTr( codec ); + HBQT_GC_T * p = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); + + hb_retl( p && p->ph ); +} + +#include + +HB_FUNC( HBQT_FINDCHILD ) +{ + QObject * object = ( QObject * ) hbqt_pPtrFromObj( 1 ); + hb_retptr( object->findChild< QObject * >( hbqt_par_QString( 2 ) ) ); +} + +HB_FUNC( HBQT_ISEQUALGCQTPOINTER ) +{ + hb_retl( hbqt_pPtrFromObj( 1 ) == hbqt_pPtrFromObj( 2 ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtcore/hbqt_base.cpp b/harbour/contrib/hbqt/qtcore/hbqt_version.cpp similarity index 70% rename from harbour/contrib/hbqt/qtcore/hbqt_base.cpp rename to harbour/contrib/hbqt/qtcore/hbqt_version.cpp index c2735dda84..00857fb44b 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_base.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_version.cpp @@ -4,10 +4,9 @@ /* * Harbour Project source code: - * QT wrapper main header + * QT version functions * - * Copyright 2009 Marcos Antonio Gambeta - * Copyright 2009 Pritpal Bedi + * Copyright 2010 Viktor Szakats (harbour.01 syenar.hu) * www - http://harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -73,46 +72,3 @@ HB_FUNC( QT_VERSION_STR ) { hb_retc_const( QT_VERSION_STR ); } - -#if QT_VERSION >= 0x040500 - -#include - -HB_FUNC( HBQT_FINDCHILD ) -{ - QObject * object = ( QObject * ) hbqt_pPtrFromObj( 1 ); - hb_retptr( object->findChild< QObject * >( hbqt_par_QString( 2 ) ) ); -} - -HB_FUNC( HBQT_ISEMPTYQTPOINTER ) -{ - HBQT_GC_T * p = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); - - if( p && p->ph ) - hb_retl( HB_FALSE ); - else - hb_retl( HB_TRUE ); -} - -HB_FUNC( HBQT_ISEQUALGCQTPOINTER ) -{ - HBQT_GC_T * p = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); - HBQT_GC_T * q = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), 2 ); - - if( p && q ) - { - if( p->ph && q->ph ) - hb_retl( p->ph == q->ph ); - else - hb_retl( HB_FALSE ); - } - else - { - if( p && p->ph ) - hb_retl( p->ph == hb_parptr( 2 ) ); - else - hb_retl( HB_FALSE ); - } -} - -#endif // #if QT_VERSION >= 0x040500 diff --git a/harbour/contrib/hbqt/qtcore/hbqtcore.hbm b/harbour/contrib/hbqt/qtcore/hbqtcore.hbm index d7461537f2..b11cec08b0 100644 --- a/harbour/contrib/hbqt/qtcore/hbqtcore.hbm +++ b/harbour/contrib/hbqt/qtcore/hbqtcore.hbm @@ -7,8 +7,9 @@ g/filelist.hbm -hbqt_base.cpp -hbqt_destruct.cpp +hbqt_pointer.cpp +hbqt_version.cpp + hbqt_hbqevents.cpp hbqt_hbqslots.cpp hbqt_hbqstring.cpp diff --git a/harbour/contrib/hbqt/qtcore/hbqtcore.hbx b/harbour/contrib/hbqt/qtcore/hbqtcore.hbx index a7a94e53d0..38f6a49b31 100644 --- a/harbour/contrib/hbqt/qtcore/hbqtcore.hbx +++ b/harbour/contrib/hbqt/qtcore/hbqtcore.hbx @@ -32,7 +32,6 @@ DYNAMIC HBQEVENTS DYNAMIC HBQSLOTS DYNAMIC HBQSTRING DYNAMIC HBQTOBJECTHANDLER -DYNAMIC HBQT_ISEMPTYQTPOINTER DYNAMIC HBQT_ISEQUALGCQTPOINTER DYNAMIC HBQT_PTR DYNAMIC HB_HBQEVENTS @@ -143,8 +142,7 @@ DYNAMIC QTRANSLATOR DYNAMIC QURL DYNAMIC QVARIANT DYNAMIC QVERSION -DYNAMIC __HBQT_SETCODECFORCSTRINGS -DYNAMIC __HBQT_SETCODECFORTR +DYNAMIC __HBQT_ISVALIDPOINTER #ifdef __HBEXTERN__HBQTCORE__REQUEST #uncommand DYNAMIC => EXTERNAL diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index b5d0edc249..c998bd2f3c 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -67,6 +67,7 @@ #include "hbclass.ch" #include "common.ch" +#include "error.ch" #include "inkey.ch" #include "xbp.ch" @@ -1284,8 +1285,18 @@ METHOD XbpWindow:currentSize() /*----------------------------------------------------------------------*/ METHOD XbpWindow:getHWND() + LOCAL oError := ErrorNew() - MsgBox( "hbQT is a not a Windows only solution !" ) + oError:severity := ES_ERROR + oError:genCode := EG_UNSUPPORTED + oError:subSystem := "HBXBP" + oError:subCode := 7000 + oError:canRetry := .F. + oError:canDefault := .F. + oError:Args := hb_AParams() + oError:operation := ProcName() + + Eval( ErrorBlock(), oError ) RETURN NIL