diff --git a/harbour/ChangeLog b/harbour/ChangeLog index db08b790fe..9b9e505dab 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,52 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-11 17:25 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * source/common/hbver.c + + Added skeleton for hb_verHostCPU() + + * source/rtl/trace.c + ! HB_TRACESTRING() fixed potential GPF if non-string parameter + was passed. + + * contrib/hbqt/generator/hbqtgen.prg + ! Fixed demo to not refer to gtgui on non-Windows systems. + ! Fixed RTE when source file isn't found. (not verified) + ! Change EOL handling. + ! Fixed to use portable path seps when generating demoqt.prg. + + * contrib/hbqt/generator/qt45.qtp + ! Fixed to use forward slashes. Didn't test if this broke non-*nix. + + * contrib/hbqt/qth/QWindowsXPStyle.qth + ! Fixed Windows specific QT function wrapper to compile on non-Windows. + + * contrib/hbqt/qth/QPixmap.qth + ! Deleted Windows specific HBITMAP related functions. + + * contrib/hbqt/tests/hbqt.hbp + + Added support for darwin + + * contrib/hbqt/Makefile + * contrib/hbqt/generator/hbqtgen.prg + + Added support for QT for Darwin official SDK package + I had to change the way headers are included to follow the + QT standard and pass each QT lib header dir on the command + line instead of using subdirs in #include directives. + ; TODO: Probably this change should be applied to all .qth files, + but on Darwin it worked without this change for some reason. + + * contrib/hbqt/tests/demoqt.prg + * contrib/hbqt/TQPixmap.prg + * contrib/hbqt/hbqt_utils.cpp + * contrib/hbqt/hbqt_qwidget.cpp + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_qwindowsxpstyle.cpp + * contrib/hbqt/hbqt_slots.cpp + * contrib/hbqt/hbqt_slots.h + * contrib/hbqt/hbqt_qpixmap.cpp + * Regenerated. + 2009-04-11 13:25 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * include/hbapi.h * include/hbver.ch diff --git a/harbour/contrib/hbqt/Makefile b/harbour/contrib/hbqt/Makefile index c467d9ea7e..dd78a62dcf 100644 --- a/harbour/contrib/hbqt/Makefile +++ b/harbour/contrib/hbqt/Makefile @@ -43,10 +43,23 @@ endif endif HB_INC_QT_OK += $(foreach d, $(HB_INC_QT), $(if $(wildcard $(d)/Qt/qglobal.h),$(d),)) +ifeq ($(HB_ARCHITECTURE),darwin) +ifeq ($(strip $(HB_INC_QT_OK)),) +HB_INC_QT_OK = $(if $(wildcard /Library/Frameworks/QtCore.framework/Versions/4/Headers/QtCore),spec,) +ifeq ($(HB_INC_QT_OK),spec) +HB_USER_CFLAGS += -I/Library/Frameworks/QtCore.framework/Headers +HB_USER_CFLAGS += -I/Library/Frameworks/QtGui.framework/Headers +HB_USER_CFLAGS += -I/Library/Frameworks/QtNetwork.framework/Headers +HB_USER_CFLAGS += -I/Library/Frameworks/QtWebKit.framework/Headers +endif +endif +endif ifneq ($(strip $(HB_INC_QT_OK)),) -HB_USER_CFLAGS += $(foreach d, $(HB_INC_QT_OK), -I$(d)) +ifneq ($(strip $(HB_INC_QT_OK)),spec) +HB_USER_CFLAGS += $(foreach d, $(HB_INC_QT_OK), -I$(d)/Qt -I$(d)/QtCore -I$(d)/QtGui -I$(d)/QtNetwork -I$(d)/QtWebKit) +endif include $(TOP)$(ROOT)contrib/hbqt/Makefile_gen diff --git a/harbour/contrib/hbqt/TQPixmap.prg b/harbour/contrib/hbqt/TQPixmap.prg index 047c4e93e6..23dc5fff46 100644 --- a/harbour/contrib/hbqt/TQPixmap.prg +++ b/harbour/contrib/hbqt/TQPixmap.prg @@ -94,7 +94,6 @@ CREATE CLASS QPixmap INHERIT QPaintDevice METHOD setMask( pMask ) INLINE Qt_QPixmap_setMask( ::pPtr, pMask ) METHOD size() INLINE Qt_QPixmap_size( ::pPtr ) METHOD toImage() INLINE Qt_QPixmap_toImage( ::pPtr ) - METHOD toWinHBITMAP( nFormat ) INLINE Qt_QPixmap_toWinHBITMAP( ::pPtr, nFormat ) METHOD transformed( pTransform, nMode ) INLINE Qt_QPixmap_transformed( ::pPtr, pTransform, nMode ) METHOD transformed_1( pMatrix, nMode ) INLINE Qt_QPixmap_transformed_1( ::pPtr, pMatrix, nMode ) METHOD width() INLINE Qt_QPixmap_width( ::pPtr ) diff --git a/harbour/contrib/hbqt/generator/hbqtgen.prg b/harbour/contrib/hbqt/generator/hbqtgen.prg index fc30d29c53..c3bcad73b6 100644 --- a/harbour/contrib/hbqt/generator/hbqtgen.prg +++ b/harbour/contrib/hbqt/generator/hbqtgen.prg @@ -289,20 +289,25 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) cFile := cProFile ENDIF IF !file( cFile ) - RETURN nil + OutStd( "Cannot find: " + cFile + s_NewLine ) + RETURN { nil } ENDIF cQth := memoread( cFile ) IF empty( cQth ) - RETURN nil + OutStd( "Cannot read: " + cFile + s_NewLine ) + RETURN { nil } ENDIF OutStd( "Processing: " + cFile + s_NewLine ) /* Prepare to be parsed properly */ - cQth := strtran( cQth, s_NewLine , _EOL ) - cQth := strtran( cQth, chr( 13 )+chr( 10 ), _EOL ) - cQth := strtran( cQth, chr( 13 ) , _EOL ) + IF ! hb_osNewLine() == _EOL + cQth := StrTran( cQth, hb_osNewLine(), _EOL ) + ENDIF + IF ! hb_osNewLine() == Chr( 13 ) + Chr( 10 ) + cQth := StrTran( cQth, Chr( 13 ) + Chr( 10 ), _EOL ) + ENDIF cls_:={} IF !empty( class_:= PullOutSection( @cQth, 'CLASS' ) ) @@ -1224,7 +1229,7 @@ STATIC FUNCTION Build_HBQT_H( cPathOut ) aadd( txt_, " " ) aadd( txt_, "#define QT_VERSION 0x040500 " ) aadd( txt_, " " ) - aadd( txt_, "#include " ) + aadd( txt_, "#include " ) aadd( txt_, " " ) aadd( txt_, "#if QT_VERSION >= 0x040500 " ) aadd( txt_, " " ) @@ -1413,7 +1418,7 @@ STATIC FUNCTION Build_HBQT_H( cPathOut ) aadd( txt_, "#define hbqt_ret_QAbstractItemModel( p ) ( hb_retptr( ( QAbstractItemModel* ) p ) ) " ) aadd( txt_, "#define hbqt_ret_QPrinter( p ) ( hb_retptr( ( QPrinter* ) p ) ) " ) aadd( txt_, " " ) - aadd( txt_, "#include " ) + aadd( txt_, "#include " ) aadd( txt_, " " ) aadd( txt_, "void hbqt_ret_QRect( QRect ); " ) aadd( txt_, "void hbqt_ret_QSize( QSize ); " ) @@ -1455,7 +1460,7 @@ STATIC FUNCTION Build_HBQT_UTILS_CPP( cPathOut ) aadd( txt_, '#if QT_VERSION >= 0x040500 ' ) aadd( txt_, '/*----------------------------------------------------------------------*/' ) aadd( txt_, ' ' ) - aadd( txt_, '#include ' ) + aadd( txt_, '#include ' ) aadd( txt_, ' ' ) aadd( txt_, '/*----------------------------------------------------------------------*/' ) aadd( txt_, ' ' ) @@ -1654,8 +1659,8 @@ STATIC FUNCTION Build_HBQT_SLOTS_H( cPathOut ) aadd( txt_, ' ' ) aadd( txt_, '#define SLOTS_H ' ) aadd( txt_, ' ' ) - aadd( txt_, '#include ' ) - aadd( txt_, '#include ' ) + aadd( txt_, '#include ' ) + aadd( txt_, '#include ' ) aadd( txt_, ' ' ) aadd( txt_, '#include "hbapi.h" ' ) aadd( txt_, '#include "hbapiitm.h" ' ) @@ -1705,9 +1710,9 @@ STATIC FUNCTION Build_HBQT_SLOTS_CPP( cPathOut ) aadd( txt_, ' ' ) aadd( txt_, '#include "hbqt_slots.h" ' ) aadd( txt_, ' ' ) - aadd( txt_, '#include ' ) - aadd( txt_, '#include ' ) - aadd( txt_, '#include ' ) + aadd( txt_, '#include ' ) + aadd( txt_, '#include ' ) + aadd( txt_, '#include ' ) aadd( txt_, ' ' ) aadd( txt_, '#define HBQT_EVT_CLICKED 1 ' ) aadd( txt_, '#define HBQT_EVT_TRIGGERED 2 ' ) @@ -2165,8 +2170,8 @@ STATIC FUNCTION Build_MOC_SLOTS_CPP( cPathOut ) /*----------------------------------------------------------------------*/ STATIC FUNCTION Build_Demo() - LOCAL cFile := '..\tests\demoqt.prg' - LOCAL txt_:={} + LOCAL cFile := '..' + s_PathSep + 'tests' + s_PathSep + 'demoqt.prg' + LOCAL txt_:= {} BuildHeader( @txt_, 2 ) @@ -2339,9 +2344,11 @@ STATIC FUNCTION Build_Demo() aadd( txt_, ' ' ) aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) aadd( txt_, ' ' ) + aadd( txt_, '#ifdef __PLATFORM__WINDOWS ' ) aadd( txt_, 'PROCEDURE hb_GtSys() ' ) aadd( txt_, ' HB_GT_GUI_DEFAULT() ' ) aadd( txt_, ' RETURN ' ) + aadd( txt_, '#endif ' ) aadd( txt_, ' ' ) aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) aadd( txt_, '/* ' ) diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index 64ab25f55a..090e70be29 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -4,11 +4,11 @@ ; Pritpal Bedi ; --I=..\qth +-I=../qth -O=.. --D=..\doc +-D=../doc QAbstractButton.qth diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index b9fd5a3d84..e18e499a13 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -59,7 +59,7 @@ #define QT_VERSION 0x040500 -#include +#include #if QT_VERSION >= 0x040500 @@ -248,7 +248,7 @@ #define hbqt_ret_QAbstractItemModel( p ) ( hb_retptr( ( QAbstractItemModel* ) p ) ) #define hbqt_ret_QPrinter( p ) ( hb_retptr( ( QPrinter* ) p ) ) -#include +#include void hbqt_ret_QRect( QRect ); void hbqt_ret_QSize( QSize ); diff --git a/harbour/contrib/hbqt/hbqt_qpixmap.cpp b/harbour/contrib/hbqt/hbqt_qpixmap.cpp index 84358effe6..d431fbd15d 100644 --- a/harbour/contrib/hbqt/hbqt_qpixmap.cpp +++ b/harbour/contrib/hbqt/hbqt_qpixmap.cpp @@ -325,14 +325,6 @@ HB_FUNC( QT_QPIXMAP_TOIMAGE ) hb_retptr( new QImage( hbqt_par_QPixmap( 1 )->toImage() ) ); } -/* - * HBITMAP toWinHBITMAP ( HBitmapFormat format = NoAlpha ) const - */ -HB_FUNC( QT_QPIXMAP_TOWINHBITMAP ) -{ - hb_retptr( new HBITMAP( hbqt_par_QPixmap( 1 )->toWinHBITMAP( ( HB_ISNIL( 2 ) ? ( QPixmap::HBitmapFormat ) QPixmap::NoAlpha : ( QPixmap::HBitmapFormat ) hb_parni( 2 ) ) ) ) ); -} - /* * QPixmap transformed ( const QTransform & transform, Qt::TransformationMode mode = Qt::FastTransformation ) const */ diff --git a/harbour/contrib/hbqt/hbqt_qwidget.cpp b/harbour/contrib/hbqt/hbqt_qwidget.cpp index e7fcb2baa2..ec4755e3d2 100644 --- a/harbour/contrib/hbqt/hbqt_qwidget.cpp +++ b/harbour/contrib/hbqt/hbqt_qwidget.cpp @@ -1532,7 +1532,7 @@ HB_FUNC( QT_QWIDGET_WIDTH ) */ HB_FUNC( QT_QWIDGET_WINID ) { - hb_retptr( ( HWND ) hbqt_par_QWidget( 1 )->winId() ); + hb_retptr( new WId( hbqt_par_QWidget( 1 )->winId() ) ); } /* diff --git a/harbour/contrib/hbqt/hbqt_qwindowsxpstyle.cpp b/harbour/contrib/hbqt/hbqt_qwindowsxpstyle.cpp index 2473d61c72..4827e97255 100644 --- a/harbour/contrib/hbqt/hbqt_qwindowsxpstyle.cpp +++ b/harbour/contrib/hbqt/hbqt_qwindowsxpstyle.cpp @@ -70,7 +70,11 @@ */ HB_FUNC( QT_QWINDOWSXPSTYLE ) { +#if defined( HB_OS_WIN ) hb_retptr( ( QWindowsXPStyle* ) new QWindowsXPStyle() ); +#else + hb_retptr( NULL ); +#endif } diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index 9a440f29d4..555a978830 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -62,9 +62,9 @@ #include "hbqt_slots.h" -#include -#include -#include +#include +#include +#include #define HBQT_EVT_CLICKED 1 #define HBQT_EVT_TRIGGERED 2 diff --git a/harbour/contrib/hbqt/hbqt_slots.h b/harbour/contrib/hbqt/hbqt_slots.h index 57c9973f2a..ef7598a014 100644 --- a/harbour/contrib/hbqt/hbqt_slots.h +++ b/harbour/contrib/hbqt/hbqt_slots.h @@ -57,8 +57,8 @@ #define SLOTS_H -#include -#include +#include +#include #include "hbapi.h" #include "hbapiitm.h" diff --git a/harbour/contrib/hbqt/hbqt_utils.cpp b/harbour/contrib/hbqt/hbqt_utils.cpp index 06d89b27a7..230cb51e31 100644 --- a/harbour/contrib/hbqt/hbqt_utils.cpp +++ b/harbour/contrib/hbqt/hbqt_utils.cpp @@ -61,7 +61,7 @@ #if QT_VERSION >= 0x040500 /*----------------------------------------------------------------------*/ -#include +#include /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qth/QPixmap.qth b/harbour/contrib/hbqt/qth/QPixmap.qth index d523ff4016..db78de5a81 100644 --- a/harbour/contrib/hbqt/qth/QPixmap.qth +++ b/harbour/contrib/hbqt/qth/QPixmap.qth @@ -135,7 +135,7 @@ QImage toImage () const # // CGImageRef toMacCGImageRef () const # -HBITMAP toWinHBITMAP ( HBitmapFormat format = NoAlpha ) const +//HBITMAP toWinHBITMAP ( HBitmapFormat format = NoAlpha ) const QPixmap transformed ( const QTransform & transform, Qt::TransformationMode mode = Qt::FastTransformation ) const QPixmap transformed ( const QMatrix & matrix, Qt::TransformationMode mode = Qt::FastTransformation ) const int width () const diff --git a/harbour/contrib/hbqt/qth/QWindowsXPStyle.qth b/harbour/contrib/hbqt/qth/QWindowsXPStyle.qth index 071ce2b7e7..1ffd70d0c6 100644 --- a/harbour/contrib/hbqt/qth/QWindowsXPStyle.qth +++ b/harbour/contrib/hbqt/qth/QWindowsXPStyle.qth @@ -71,7 +71,11 @@ New = */ HB_FUNC( QT_QWINDOWSXPSTYLE ) { +#if defined( HB_OS_WIN ) hb_retptr( ( QWindowsXPStyle* ) new QWindowsXPStyle() ); +#else + hb_retptr( NULL ); +#endif } diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 7a32895eca..cf0a7edd73 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -76,6 +76,7 @@ INIT PROCEDURE Qt_Start() qt_qapplication() + /*qt_qapplication_setstyle( QT_PTROF( QWindowsXPStyle():new() ) )*/ RETURN EXIT PROCEDURE Qt_End() @@ -86,23 +87,43 @@ EXIT PROCEDURE Qt_End() PROCEDURE Main() Local oLabel - Local oWnd - Local oMenuBar + Local oWnd, oSize + Local oMenuBar, pIcon Local oMenuA, pAction - LOCAL oPS, oPPrv, oMB, oWZ, oCD, oWP + LOCAL oPS, oPPrv, oMB, oWZ, oCD, oWP, oSBar, oStyle oWnd := QMainWindow():new() - oWnd:setWindowTitle("Testing - QMainWindow, QMenu, QMenuBar and QAction " ) + oWnd:setWindowTitle( "Testing - QMainWindow, QMenu, QMenuBar and QAction " ) + oWnd:setWindowIcon( "test" ) + pIcon := oWnd:windowIcon() + + /* The method 2 */ oWnd:resize( 640, 400 ) - oWnd:Show() + #if 0 + /* The method 2 */ + oSize := QSize():new() + oSize:setWidth( 640 ) + oSize:setHeight( 400 ) + oWnd:resize_1( QT_PTROF( oSize ) ) + #endif Build_MenuBar( oWnd ) + oSBar := QStatusBar():new( QT_PTROF( oWnd ) ) + oWnd:setStatusBar( QT_PTROF( oSBar ) ) + oSBar:showMessage( "Harbour-QT Statusbar Ready!" ) + + oStyle := QWindowsXPStyle() + oStyle:standardIcon( 2 ) + oWnd:setStyle( QT_PTROF( oStyle ) ) + oLabel := QLabel():New( QT_PTROF( oWnd ) ) oLabel:setText( "Testing Harbour + Qt" ) oLabel:move( 200,100 ) oLabel:show() + oWnd:Show() + RETURN /*----------------------------------------------------------------------*/ @@ -200,9 +221,11 @@ STATIC FUNCTION Dialogs( cType, w, l ) /*----------------------------------------------------------------------*/ +#ifdef __PLATFORM__WINDOWS PROCEDURE hb_GtSys() HB_GT_GUI_DEFAULT() RETURN +#endif /*----------------------------------------------------------------------*/ /* diff --git a/harbour/contrib/hbqt/tests/hbqt.hbp b/harbour/contrib/hbqt/tests/hbqt.hbp index 0e8d4359a5..b69227d6bd 100644 --- a/harbour/contrib/hbqt/tests/hbqt.hbp +++ b/harbour/contrib/hbqt/tests/hbqt.hbp @@ -2,10 +2,15 @@ # $Id$ # -{mingw}libs=supc++ +{mingw|gcc}libs=supc++ libs=hbqt -libs=QtCore4 QtGui4 QtNetwork4 QtWebKit4 +{!darwin}libs=QtCore4 QtGui4 QtNetwork4 QtWebKit4 +{darwin}libs=/Library/Frameworks/QtCore.framework/QtCore +{darwin}libs=/Library/Frameworks/QtGui.framework/QtGui +{darwin}libs=/Library/Frameworks/QtNetwork.framework/QtNetwork +{darwin}libs=/Library/Frameworks/QtWebKit.framework/QtWebKit # static libs #libs=QtCore QtGui QtNetwork QtWebKit gui=yes gt=gtnul + diff --git a/harbour/source/common/hbver.c b/harbour/source/common/hbver.c index 2da917280f..bae0d8b23d 100644 --- a/harbour/source/common/hbver.c +++ b/harbour/source/common/hbver.c @@ -218,6 +218,15 @@ const char * hb_verCPU( void ) return HB_CPU_STR; } +char * hb_verHostCPU( void ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_verHostCPU()")); + + /* TODO */ + + return ""; +} + /* NOTE: OS() function, as a primary goal will detect the version number of the target platform. As an extra it may also detect the host OS. The latter is mainly an issue in DOS, where the host OS can be OS/2 diff --git a/harbour/source/rtl/trace.c b/harbour/source/rtl/trace.c index 921b520b68..ff2a9b96fa 100644 --- a/harbour/source/rtl/trace.c +++ b/harbour/source/rtl/trace.c @@ -65,7 +65,7 @@ HB_FUNC( HB_TRACELEVEL ) HB_FUNC( HB_TRACESTRING ) { - char * szMessage = hb_parc( 1 ); + char * szMessage = hb_parcx( 1 ); if( szMessage ) { HB_TRACE(HB_TR_ALWAYS, ("%s", szMessage) );