From 738356ea9bb6505ee9ca6365a82a17686ccad63c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 28 Oct 2010 21:52:34 +0000 Subject: [PATCH] 2010-10-28 23:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtcore/hbqt_misc.prg + Changed to not RTE when disconnecting not-connected event. It will instead return .F. now. To be consistent with slots in this regard. * Undone previous optimization after realizing that events and slots low-functiona return different error codes. It didn't cause any harm with current system though. * contrib/hbqt/qtcore/hbqt_hbqevents.cpp % Optimized hb_snprintf() calls. * contrib/hbqt/qtcore/hbqt_hbqevents.cpp * contrib/hbqt/qtcore/hbqt_hbqslots.cpp * Formatting. * src/common/hbver.c * Name of SPARC adjusted. Thanks to Tamas Tevesz. --- harbour/ChangeLog | 19 +++++++ .../contrib/hbqt/qtcore/hbqt_hbqevents.cpp | 8 +-- harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp | 2 +- harbour/contrib/hbqt/qtcore/hbqt_misc.prg | 50 ++++++++++++------- harbour/src/common/hbver.c | 4 +- 5 files changed, 59 insertions(+), 24 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c6b2103b2c..c4d39b4089 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,25 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-28 23:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qtcore/hbqt_misc.prg + + Changed to not RTE when disconnecting not-connected + event. It will instead return .F. now. + To be consistent with slots in this regard. + * Undone previous optimization after realizing that + events and slots low-functiona return different error codes. + It didn't cause any harm with current system though. + + * contrib/hbqt/qtcore/hbqt_hbqevents.cpp + % Optimized hb_snprintf() calls. + + * contrib/hbqt/qtcore/hbqt_hbqevents.cpp + * contrib/hbqt/qtcore/hbqt_hbqslots.cpp + * Formatting. + + * src/common/hbver.c + * Name of SPARC adjusted. Thanks to Tamas Tevesz. + 2010-10-28 19:25 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtcore/hbqt_misc.prg * Laxed the rules for handling low-level connect/disconnect errors. diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp index 76e3eff9e8..d5dec8518b 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp @@ -189,14 +189,14 @@ HB_FUNC( __HBQT_EVENTS_CONNECT ) if( t_events ) { - QObject * object = ( QObject* ) hbqt_pPtrFromObj( 2 ); /* get sender */ + QObject * object = ( QObject * ) hbqt_pPtrFromObj( 2 ); /* get sender */ if( object ) { int type = hb_parni( 3 ); char prop[ 20 ]; - hb_snprintf( prop, sizeof( prop ), "%s%i%s", "P", type, "P" ); /* Make it a unique identifier */ + hb_snprintf( prop, sizeof( prop ), "P%iP", type ); /* Make it a unique identifier */ int i = object->property( prop ).toInt(); if( i == 0 ) /* No Duplicates of same event with same object - it is a design decision - never alter */ @@ -228,14 +228,14 @@ HB_FUNC( __HBQT_EVENTS_DISCONNECT ) if( t_events ) { - QObject * object = ( QObject* ) hbqt_pPtrFromObj( 2 ); + QObject * object = ( QObject * ) hbqt_pPtrFromObj( 2 ); if( object ) { int type = hb_parni( 3 ); char prop[ 20 ]; - hb_snprintf( prop, sizeof( prop ), "%s%i%s", "P", type, "P" ); /* Make it a unique identifier */ + hb_snprintf( prop, sizeof( prop ), "P%iP", type ); /* Make it a unique identifier */ int i = object->property( prop ).toInt(); if( i > 0 && i <= t_events->listBlock.size() ) diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp index 52c455090c..adeae5008f 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp @@ -201,7 +201,7 @@ HB_FUNC( __HBQT_SLOTS_CONNECT ) if( t_slots ) { - QObject * object = ( QObject * ) hbqt_pPtrFromObj( 2 ); /* get sender */ + QObject * object = ( QObject * ) hbqt_pPtrFromObj( 2 ); /* get sender */ if( object ) { PHB_ITEM pBlock = hb_itemNew( hb_param( 4, HB_IT_BLOCK ) ); /* get codeblock */ diff --git a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg index e509ae0122..654260ea1e 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg +++ b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg @@ -131,6 +131,13 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) ::__pSlots := __hbqt_slots_new() ENDIF nResult := __hbqt_slots_connect( ::__pSlots, ::pPtr, cnEvent, bBlock ) + + SWITCH nResult + CASE 0 + RETURN .T. + CASE 8 /* QT connect call failure */ + RETURN .F. + ENDSWITCH EXIT CASE "N" @@ -140,19 +147,17 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) ::installEventFilter( HBQEventsFromPointer( ::__pEvents ) ) ENDIF nResult := __hbqt_events_connect( ::__pEvents, ::pPtr, cnEvent, bBlock ) + + SWITCH nResult + CASE 0 + RETURN .T. + ENDSWITCH EXIT OTHERWISE nResult := 99 ENDSWITCH - SWITCH nResult - CASE 0 - RETURN .T. - CASE 8 /* QT connect call failure */ - RETURN .F. - ENDSWITCH - __hbqt_error( 1200 + nResult ) RETURN .F. @@ -164,25 +169,36 @@ METHOD HbQtObjectHandler:disconnect( cnEvent ) SWITCH ValType( cnEvent ) CASE "C" + nResult := __hbqt_slots_disconnect( ::__pSlots, ::pPtr, cnEvent ) + + SWITCH nResult + CASE 0 + CASE 4 /* signal not found in object */ + CASE 5 /* disconnect failure */ + RETURN .T. + CASE 1 /* wrong slot container, no connect was called yet */ + CASE 3 /* event not found */ + RETURN .F. + ENDSWITCH EXIT + CASE "N" + nResult := __hbqt_events_disconnect( ::__pEvents, ::pPtr, cnEvent ) + + SWITCH nResult + CASE 0 + RETURN .T. + CASE -3 /* event not found */ + RETURN .F. + ENDSWITCH EXIT + OTHERWISE nResult := 99 ENDSWITCH - SWITCH nResult - CASE 0 - CASE 4 /* signal not found in object */ - CASE 5 /* disconnect failure */ - RETURN .T. - CASE 1 /* wrong slot container, no connect was called yet */ - CASE 3 /* event not found */ - RETURN .F. - ENDSWITCH - __hbqt_error( 1300 + nResult ) RETURN .F. diff --git a/harbour/src/common/hbver.c b/harbour/src/common/hbver.c index c86ccce6b3..3e279fb02a 100644 --- a/harbour/src/common/hbver.c +++ b/harbour/src/common/hbver.c @@ -112,9 +112,9 @@ const char * hb_verCPU( void ) #elif defined( HB_CPU_PPC_64 ) return "PPC64"; #elif defined( HB_CPU_SPARC ) - return "Sparc/32"; + return "SPARC"; #elif defined( HB_CPU_SPARC_64 ) - return "Sparc/64"; + return "SPARC64"; #elif defined( HB_CPU_ARM ) return "ARM"; #elif defined( HB_CPU_MIPS )