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.
This commit is contained in:
Viktor Szakats
2010-09-29 19:25:50 +00:00
parent 54b14ed50f
commit f26660f64d
9 changed files with 89 additions and 87 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 )
/*----------------------------------------------------------------------*/

View File

@@ -59,8 +59,6 @@
#if QT_VERSION >= 0x040500
#include <QtCore/QTextCodec>
/*----------------------------------------------------------------------*/
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 <QtCore/QObject>
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 ) );
}
/*----------------------------------------------------------------------*/

View File

@@ -4,10 +4,9 @@
/*
* Harbour Project source code:
* QT wrapper main header
* QT version functions
*
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* 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 <QtCore/QObject>
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

View File

@@ -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

View File

@@ -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 <fncs,...> => EXTERNAL <fncs>

View File

@@ -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