diff --git a/harbour/ChangeLog b/harbour/ChangeLog index efc1bd6fc1..a4ccef6c98 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,39 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-15 09:52 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qtcore/hbqt_pointer.cpp + * contrib/hbqt/qtcore/hbqtcore.hbx + + HBQT_ISOBJECT() will return .T. is the passed object is a HBQT one. + + * contrib/hbqt/qtcore/hbqt_misc.prg + * :isValidObject() -> :hasValidPointer() + + :fromPointer(): New method used solely to convert raw QT pointers + to HBQT objects. In such case no object type checking can be done, + so it's dangerious, thus raw pointers should eventually be eliminated + from HBQT code and as final step this method removed. + The method will RTE is non-pointer parameter is passed. + + Added TODOs. + ; TODO: Change :from() method to only allow QT object input parameter + and RTE otherwise. At the same time :from() calls with pointer + input should be changed to :fromPointer(). As next step :from() + should be moved to class level and proper object type checking + added to avoid assigning wrong QT object to HBQT object wrapper. + + * contrib/hbxbp/xbplistbox.prg + * contrib/hbxbp/xbpwindow.prg + * contrib/hbxbp/xbptreeview.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/ideedit.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/hbqreportsmanager.prg + * contrib/hbide/ideharbourhelp.prg + * contrib/hbide/ideskeletons.prg + * :isValidObject() -> :hasValidPointer() + + * INSTALL + + Added OS/2 GCC link. + 2010-10-14 20:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * harbour/utils/hbmk2/hbmk2.prg + *nix builds will now use /opt/harbour/contrib and /opt/harbour/addons diff --git a/harbour/INSTALL b/harbour/INSTALL index c58531f135..a58d171d40 100644 --- a/harbour/INSTALL +++ b/harbour/INSTALL @@ -659,7 +659,7 @@ HARBOUR NOTE: In current implementation it's appended to compiler directory name, so all filesystem/platform name rules and limits - apply. (Back)slashes will be stripped from + apply. (Back)slashes will be stripped from the name though. - HB_BUILD_PKG=yes Create release package. Default: no Requires 'clean install' in root source dir. @@ -1439,6 +1439,7 @@ HARBOUR ftp://ftp.netlabs.org/pub/gcc/libc-0_6_3-csd3.exe http://os2ports.smedley.info/index.php?page=gcc http://os2ports.smedley.info/index.php?page=gcc44 + http://download.smedley.info/gcc-4.4.5-os2-20101004.zip DJGPP [dos, *nix, free, open-source] http://www.delorie.com/djgpp/ Open Watcom [win, dos, os2, linux, free, open-source] diff --git a/harbour/contrib/hbide/hbqreportsmanager.prg b/harbour/contrib/hbide/hbqreportsmanager.prg index f9c6fac185..6642e9e402 100644 --- a/harbour/contrib/hbide/hbqreportsmanager.prg +++ b/harbour/contrib/hbide/hbqreportsmanager.prg @@ -528,7 +528,7 @@ METHOD HbqReportsManager:execEvent( cEvent, p, p1, p2 ) EXIT CASE "QEvent_MouseMoveMenu" - IF empty( ::qPos ) .OR. empty( ::qAct ) .OR. ! ::qAct:isValidObject() + IF empty( ::qPos ) .OR. empty( ::qAct ) .OR. ! ::qAct:hasValidPointer() EXIT ENDIF @@ -1071,7 +1071,7 @@ METHOD HbqReportsManager:contextMenuScene( p1 ) qMenu:addAction( "Refresh" ) qMenu:addAction( "Zoom+" ) - IF ( qAct := qMenu:exec( qEvent:screenPos() ) ):isValidObject() + IF ( qAct := qMenu:exec( qEvent:screenPos() ) ):hasValidPointer() SWITCH qAct:text() CASE "Refresh" EXIT @@ -1095,7 +1095,7 @@ METHOD HbqReportsManager:contextMenuItem( p1, p2 ) qMenu:addAction( "Cut" ) qMenu:addAction( "Copy" ) - IF ( qAct := qMenu:exec( qEvent:screenPos() ) ):isValidObject() + IF ( qAct := qMenu:exec( qEvent:screenPos() ) ):hasValidPointer() SWITCH qAct:text() CASE "Cut" EXIT @@ -1826,7 +1826,7 @@ METHOD HqrGraphicsItem:contextMenu( p1, p2 ) qMenu:addAction( "Copy" ) qAct := qMenu:exec( qEvent:screenPos() ) - IF qAct:isValidObject() + IF qAct:hasValidPointer() SWITCH qAct:text() CASE "Cut" EXIT diff --git a/harbour/contrib/hbide/ideedit.prg b/harbour/contrib/hbide/ideedit.prg index 8b528806f6..dc6dbd10ad 100644 --- a/harbour/contrib/hbide/ideedit.prg +++ b/harbour/contrib/hbide/ideedit.prg @@ -450,7 +450,7 @@ METHOD IdeEdit:execEvent( nMode, oEdit, p, p1 ) ::oEM:aActions[ 19, 2 ]:setEnabled( len( ::oEditor:aEdits ) == 0 .OR. ::oEditor:nSplOrient == -1 .OR. ::oEditor:nSplOrient == 2 ) ::oEM:aActions[ 21, 2 ]:setEnabled( n > 0 ) - IF ! ( qAct := ::oEM:qContextMenu:exec( qEdit:mapToGlobal( QPoint( p ) ) ) ):isValidObject() + IF ! ( qAct := ::oEM:qContextMenu:exec( qEdit:mapToGlobal( QPoint( p ) ) ) ):hasValidPointer() RETURN Self ENDIF diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index 01ec7386ca..cc94b45d42 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -975,7 +975,7 @@ METHOD IdeFindInFiles:execContextMenu( p ) qMenu:addAction( "Zoom In" ) qMenu:addAction( "Zoom Out" ) - IF ( qAct := qMenu:exec( ::oUI:q_editResults:mapToGlobal( QPoint( p ) ) ) ):isValidObject() + IF ( qAct := qMenu:exec( ::oUI:q_editResults:mapToGlobal( QPoint( p ) ) ) ):hasValidPointer() cAct := qAct:text() SWITCH cAct diff --git a/harbour/contrib/hbide/ideharbourhelp.prg b/harbour/contrib/hbide/ideharbourhelp.prg index 03ae327306..93a24c1481 100644 --- a/harbour/contrib/hbide/ideharbourhelp.prg +++ b/harbour/contrib/hbide/ideharbourhelp.prg @@ -490,7 +490,7 @@ METHOD IdeHarbourHelp:execEvent( nMode, p, p1 ) CASE "buttonUp_clicked" IF ::nCurInHist > 1 .AND. ::nCurInHist <= len( ::aHistory ) - IF ( qTWItem := ::oUI:q_treeDoc:itemAbove( ::oUI:q_treeDoc:currentItem( 0 ) ) ):isValidObject() + IF ( qTWItem := ::oUI:q_treeDoc:itemAbove( ::oUI:q_treeDoc:currentItem( 0 ) ) ):hasValidPointer() ::oUI:q_treeDoc:setCurrentItem( qTWItem, 0 ) ENDIF ENDIF diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 00afb0cacf..4c7a24e22d 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -171,7 +171,7 @@ FUNCTION hbide_execPopup( aPops, aqPos, qParent ) ELSEIF hb_isPointer( aqPos ) qPoint := qParent:mapToGlobal( QPoint( aqPos ) ) ENDIF - IF ( qAct := qPop:exec( qPoint ) ):isValidObject() + IF ( qAct := qPop:exec( qPoint ) ):hasValidPointer() cAct := qAct:text() FOR EACH a_ IN aPops IF hb_isObject( a_[ 1 ] ) diff --git a/harbour/contrib/hbide/ideskeletons.prg b/harbour/contrib/hbide/ideskeletons.prg index 5f68b5a935..b2a60ad87b 100644 --- a/harbour/contrib/hbide/ideskeletons.prg +++ b/harbour/contrib/hbide/ideskeletons.prg @@ -349,7 +349,7 @@ METHOD IdeSkeletons:selectByMenuAndPostText( qEdit ) qMenu:addAction( a_[ 1 ] ) NEXT - IF ( qAct := qMenu:exec( qEdit:mapToGlobal( QPoint( qRect:x(), qRect:y() ) ) ) ):isValidObject() + IF ( qAct := qMenu:exec( qEdit:mapToGlobal( QPoint( qRect:x(), qRect:y() ) ) ) ):hasValidPointer() IF !empty( cText := ::getText( qAct:text() ) ) ::postText( qEdit, cText ) ENDIF diff --git a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg index 3a1b9fc372..e0db537279 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg +++ b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg @@ -62,7 +62,8 @@ CLASS HbQtObjectHandler VAR pEvents METHOD from( xObject ) - METHOD isValidObject() + METHOD fromPointer( pPtr ) + METHOD hasValidPointer() METHOD connect( cnEvent, bBlock ) METHOD disconnect( cnEvent ) @@ -73,11 +74,10 @@ ENDCLASS /*----------------------------------------------------------------------*/ -METHOD HbQtObjectHandler:isValidObject() - RETURN __hbqt_IsValidPointer( ::pPtr ) - -/*----------------------------------------------------------------------*/ - +/* NOTE: Deprecated: passing raw pointers to this function + TODO: Generate RTE when non QT object is passed. + TODO: Move thid to class implementation level so that proper object + type checking can be done. */ METHOD HbQtObjectHandler:from( xObject ) LOCAL pPtr IF hb_isPointer( pPtr := hbqt_ptr( xObject ) ) @@ -87,6 +87,24 @@ METHOD HbQtObjectHandler:from( xObject ) /*----------------------------------------------------------------------*/ +/* TODO: Drop this function when all raw QT pointers are fully eliminated from .prg level. */ +METHOD HbQtObjectHandler:fromPointer( pPtr ) + IF hb_isPointer( pPtr ) + ::pPtr := pPtr + ELSE + hbqt_Error() + ENDIF + RETURN Self + +/*----------------------------------------------------------------------*/ + +/* TODO: Drop this function, as it's not desired to have invalid QT pointers wrapped + into valid .prg level QT objects. */ +METHOD HbQtObjectHandler:hasValidPointer() + RETURN __hbqt_IsValidPointer( ::pPtr ) + +/*----------------------------------------------------------------------*/ + METHOD HbQtObjectHandler:onError() LOCAL cMsg := __GetMessage() LOCAL oError diff --git a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp index 46776be2d5..0e9ca4b87f 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp @@ -188,6 +188,22 @@ void * hbqt_pPtrFromObj( int iParam ) } } +HB_FUNC( HBQT_ISOBJECT ) +{ + PHB_ITEM pParam = hb_param( 1, HB_IT_OBJECT ); + + if( pParam ) + { + hb_vmPushSymbol( hb_dynsymSymbol( hb_dynsymFindName( "PPTR" ) ) ); + hb_vmPush( pParam ); + hb_vmSend( 0 ); + + hb_retl( hb_param( -1, HB_IT_POINTER ) != NULL ); + } + else + hb_retl( HB_FALSE ); +} + HB_FUNC( HBQT_PTR ) { PHB_ITEM pParam = hb_param( 1, HB_IT_ANY ); diff --git a/harbour/contrib/hbqt/qtcore/hbqtcore.hbx b/harbour/contrib/hbqt/qtcore/hbqtcore.hbx index 1321dfb8cb..d9902958f5 100644 --- a/harbour/contrib/hbqt/qtcore/hbqtcore.hbx +++ b/harbour/contrib/hbqt/qtcore/hbqtcore.hbx @@ -35,6 +35,7 @@ DYNAMIC HBQTOBJECTHANDLER DYNAMIC HBQT_ERROR DYNAMIC HBQT_FINDCHILD DYNAMIC HBQT_ISEQUALGCQTPOINTER +DYNAMIC HBQT_ISOBJECT DYNAMIC HBQT_PTR DYNAMIC HB_HBQEVENTS DYNAMIC HB_HBQSLOTS diff --git a/harbour/contrib/hbxbp/xbplistbox.prg b/harbour/contrib/hbxbp/xbplistbox.prg index a780f63923..c9d8c3bbc6 100644 --- a/harbour/contrib/hbxbp/xbplistbox.prg +++ b/harbour/contrib/hbxbp/xbplistbox.prg @@ -274,7 +274,7 @@ METHOD XbpListBox:execSlot( cSlot, p ) IF cSlot == "customContextMenuRequested(QPoint)" IF hb_isBlock( ::hb_contextMenu ) qPos := QPoint( p ) - IF ( qItm := ::oWidget:itemAt( qPos ) ):isValidObject() + IF ( qItm := ::oWidget:itemAt( qPos ) ):hasValidPointer() IF ( n := ascan( ::aItems, {|o| hbqt_IsEqualGcQtPointer( o, qItm ) } ) ) > 0 qPt := ::oWidget:mapToGlobal( QPoint( p ) ) eval( ::hb_contextMenu, { qPt:x(), qPt:y() }, NIL, ::aItems[ n ] ) @@ -363,7 +363,7 @@ METHOD XbpListBox:clear( lConnect ) qItm := NIL NEXT ::aItems := {} - IF ::oWidget:isValidObject() + IF ::oWidget:hasValidPointer() IF lConnect ::oWidget:clear() ENDIF diff --git a/harbour/contrib/hbxbp/xbptreeview.prg b/harbour/contrib/hbxbp/xbptreeview.prg index 5f0f51c511..0936ac0136 100644 --- a/harbour/contrib/hbxbp/xbptreeview.prg +++ b/harbour/contrib/hbxbp/xbptreeview.prg @@ -207,7 +207,7 @@ METHOD XbpTreeView:execSlot( cSlot, p ) CASE cSlot == "customContextMenuRequested(QPoint)" IF hb_isBlock( ::hb_contextMenu ) qPos := QPoint( p ) - IF ( qItem := ::oWidget:itemAt( qPos ) ):isValidObject() + IF ( qItem := ::oWidget:itemAt( qPos ) ):hasValidPointer() IF ( n := ascan( ::aItems, {|o| hbqt_IsEqualGcQtPointer( o:oWidget, qItem ) } ) ) > 0 qPt := ::oWidget:mapToGlobal( QPoint( p ) ) eval( ::hb_contextMenu, { qPt:x(), qPt:y() }, NIL, ::aItems[ n ] ) diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index 98c7a929e1..c7179bddb7 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -381,7 +381,7 @@ METHOD XbpWindow:setQtProperty( cProperty ) METHOD XbpWindow:postCreate() - ::status := iif( ::oWidget:isValidObject(), XBP_STAT_CREATE, XBP_STAT_FAILURE ) + ::status := iif( ::oWidget:hasValidPointer(), XBP_STAT_CREATE, XBP_STAT_FAILURE ) RETURN Self