From ba2d781456e99a52a4997632e520009103534b95 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sat, 23 Oct 2010 18:37:12 +0000 Subject: [PATCH] 2010-10-23 11:30 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtcore/doc/en/class_hbqslots.txt * contrib/hbqt/qtcore/g/HBQSlots.cpp * contrib/hbqt/qtcore/g/THBQSlots.prg * contrib/hbqt/qtcore/qth/HBQSlots.qth - Deleted: unused methods. * contrib/hbqt/qtcore/hbqt_hbqslots.cpp * contrib/hbqt/qtcore/hbqt_hbqslots.h - Deleted: unused methods. ! Fixed: wrong notations: "QModel" => "QModelIndex" Signal/Slots are now bare sleek and scalable. --- harbour/ChangeLog | 14 ++ .../hbqt/qtcore/doc/en/class_hbqslots.txt | 6 - harbour/contrib/hbqt/qtcore/g/HBQSlots.cpp | 50 +----- harbour/contrib/hbqt/qtcore/g/THBQSlots.prg | 48 ------ harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp | 146 +----------------- harbour/contrib/hbqt/qtcore/hbqt_hbqslots.h | 6 - harbour/contrib/hbqt/qtcore/qth/HBQSlots.qth | 4 - 7 files changed, 20 insertions(+), 254 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ef1579f313..aa75515a48 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,20 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-23 11:30 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtcore/doc/en/class_hbqslots.txt + * contrib/hbqt/qtcore/g/HBQSlots.cpp + * contrib/hbqt/qtcore/g/THBQSlots.prg + * contrib/hbqt/qtcore/qth/HBQSlots.qth + - Deleted: unused methods. + + * contrib/hbqt/qtcore/hbqt_hbqslots.cpp + * contrib/hbqt/qtcore/hbqt_hbqslots.h + - Deleted: unused methods. + ! Fixed: wrong notations: "QModel" => "QModelIndex" + + Signal/Slots are now bare sleek and scalable. + 2010-10-23 11:02 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/hbqreportsmanager.prg * contrib/hbide/idebrowse.prg diff --git a/harbour/contrib/hbqt/qtcore/doc/en/class_hbqslots.txt b/harbour/contrib/hbqt/qtcore/doc/en/class_hbqslots.txt index b11c28fab8..886d25a345 100644 --- a/harbour/contrib/hbqt/qtcore/doc/en/class_hbqslots.txt +++ b/harbour/contrib/hbqt/qtcore/doc/en/class_hbqslots.txt @@ -24,12 +24,6 @@ * * $RETURNS$ * An instance of the object of type HBQSlots - * $METHODS$ - * :hbConnect( xPObj, cSlot, xBBlock ) -> lBool - * :hbDisconnect( xObj, cSlot ) -> lBool - * :hbIsConnected( xObj, cSlot ) -> lBool - * :hbClear() -> lBool - * * $DESCRIPTION$ * * $EXAMPLES$ diff --git a/harbour/contrib/hbqt/qtcore/g/HBQSlots.cpp b/harbour/contrib/hbqt/qtcore/g/HBQSlots.cpp index 3c61c9ec06..c89129ded0 100644 --- a/harbour/contrib/hbqt/qtcore/g/HBQSlots.cpp +++ b/harbour/contrib/hbqt/qtcore/g/HBQSlots.cpp @@ -98,7 +98,7 @@ /*----------------------------------------------------------------------*/ /* - * Constructed[ 4/4 [ 100.00% ] ] + * Constructed[ 0/0 [ 0% ] ] * */ @@ -187,54 +187,6 @@ HB_FUNC( QT_HBQSLOTS ) hb_retptrGC( hbqt_gcAllocate_HBQSlots( ( void * ) pObj, true ) ); } -/* - * bool hbConnect( PHB_ITEM pObj, const char * slot, PHB_ITEM bBlock ) - */ -HB_FUNC( QT_HBQSLOTS_HBCONNECT ) -{ - HBQSlots * p = hbqt_par_HBQSlots( 1 ); - if( p ) - { - hb_retl( ( p )->hbConnect( hb_param( 2, HB_IT_ANY ), ( const char * ) hb_parc( 3 ), hb_param( 4, HB_IT_ANY ) ) ); - } -} - -/* - * bool hbDisconnect( PHB_ITEM obj, const char * slot ) - */ -HB_FUNC( QT_HBQSLOTS_HBDISCONNECT ) -{ - HBQSlots * p = hbqt_par_HBQSlots( 1 ); - if( p ) - { - hb_retl( ( p )->hbDisconnect( hb_param( 2, HB_IT_ANY ), ( const char * ) hb_parc( 3 ) ) ); - } -} - -/* - * bool hbIsConnected( PHB_ITEM obj, const char * slot ) - */ -HB_FUNC( QT_HBQSLOTS_HBISCONNECTED ) -{ - HBQSlots * p = hbqt_par_HBQSlots( 1 ); - if( p ) - { - hb_retl( ( p )->hbIsConnected( hb_param( 2, HB_IT_ANY ), ( const char * ) hb_parc( 3 ) ) ); - } -} - -/* - * bool hbClear() - */ -HB_FUNC( QT_HBQSLOTS_HBCLEAR ) -{ - HBQSlots * p = hbqt_par_HBQSlots( 1 ); - if( p ) - { - hb_retl( ( p )->hbClear() ); - } -} - /*----------------------------------------------------------------------*/ #endif /* #if QT_VERSION >= 0x040500 */ diff --git a/harbour/contrib/hbqt/qtcore/g/THBQSlots.prg b/harbour/contrib/hbqt/qtcore/g/THBQSlots.prg index 0096923c26..5330f1a48a 100644 --- a/harbour/contrib/hbqt/qtcore/g/THBQSlots.prg +++ b/harbour/contrib/hbqt/qtcore/g/THBQSlots.prg @@ -106,10 +106,6 @@ CREATE CLASS HBQSlots INHERIT HbQtObjectHandler, HB_QObject FUNCTION HB_HBQSlots METHOD new( ... ) - METHOD hbConnect // ( xPObj, cSlot, xBBlock ) -> lBool - METHOD hbDisconnect // ( xObj, cSlot ) -> lBool - METHOD hbIsConnected // ( xObj, cSlot ) -> lBool - METHOD hbClear // ( ) -> lBool ENDCLASS @@ -122,47 +118,3 @@ METHOD HBQSlots:new( ... ) ::pPtr := Qt_HBQSlots( ... ) RETURN Self - -METHOD HBQSlots:hbConnect( ... ) - SWITCH PCount() - CASE 3 - DO CASE - CASE ( hb_pvalue( 1 ) != NIL ) .AND. hb_isChar( hb_pvalue( 2 ) ) .AND. ( hb_pvalue( 3 ) != NIL ) - RETURN Qt_HBQSlots_hbConnect( ::pPtr, ... ) - ENDCASE - EXIT - ENDSWITCH - RETURN __hbqt_error() - - -METHOD HBQSlots:hbDisconnect( ... ) - SWITCH PCount() - CASE 2 - DO CASE - CASE ( hb_pvalue( 1 ) != NIL ) .AND. hb_isChar( hb_pvalue( 2 ) ) - RETURN Qt_HBQSlots_hbDisconnect( ::pPtr, ... ) - ENDCASE - EXIT - ENDSWITCH - RETURN __hbqt_error() - - -METHOD HBQSlots:hbIsConnected( ... ) - SWITCH PCount() - CASE 2 - DO CASE - CASE ( hb_pvalue( 1 ) != NIL ) .AND. hb_isChar( hb_pvalue( 2 ) ) - RETURN Qt_HBQSlots_hbIsConnected( ::pPtr, ... ) - ENDCASE - EXIT - ENDSWITCH - RETURN __hbqt_error() - - -METHOD HBQSlots:hbClear( ... ) - SWITCH PCount() - CASE 0 - RETURN Qt_HBQSlots_hbClear( ::pPtr, ... ) - ENDSWITCH - RETURN __hbqt_error() - diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp index f13370c9f6..eac4c3ef37 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp @@ -341,38 +341,6 @@ static bool disconnect_signal( QObject * object, QString signal ) static void hbqt_SlotsProxy( HBQSlots * t_slots, int id, QObject * object, void ** arguments ) { - // array of function calls - // static void *( arrayFunc[23])(PHB_ITEM *, void ** ) { - // - #if 0 - static void * ( arrayFunc[ 23 ] ) - { - hbqt_SlotsExecInt , - hbqt_SlotsExecIntInt , - hbqt_SlotsExecIntIntInt , - hbqt_SlotsExecIntIntIntInt , - hbqt_SlotsExecBool , - hbqt_SlotsExecQRectInt , - hbqt_SlotsExecString , - hbqt_SlotsExecModel , - hbqt_SlotsExecModelModel , - hbqt_SlotsExecItemSelItemSel , - hbqt_SlotsExecTextCharFormat , - hbqt_SlotsExecFont , - hbqt_SlotsExecQTextCursor , - hbqt_SlotsExecStringList , - hbqt_SlotsExecPointer , - hbqt_SlotsExecPointerPointer , - hbqt_SlotsExecPointerInt , - hbqt_SlotsExecQDate , - hbqt_SlotsExecQDateTime , - hbqt_SlotsExecQPoint , - hbqt_SlotsExecQRectF , - hbqt_SlotsExecQTime , - hbqt_SlotsExecQUrl - } - #endif - static QList< QByteArray > argCombinations; if( argCombinations.size() == 0 ) @@ -384,8 +352,8 @@ static void hbqt_SlotsProxy( HBQSlots * t_slots, int id, QObject * object, void "bool" << "QRect$int" << "QString" << - "QModel" << - "QModel$QModel" << + "QModelIndex" << + "QModelIndex$QModelIndex" << "QItemSelection$QItemSelection" << "QTextCharFormat" << "QFont" << @@ -399,8 +367,7 @@ static void hbqt_SlotsProxy( HBQSlots * t_slots, int id, QObject * object, void "QPoint" << "QRectF" << "QTime" << - "QUrl" << - "QModelIndex$QModelIndex" ; + "QUrl" ; } const QMetaMethod meta = object->metaObject()->method( id ); @@ -409,8 +376,6 @@ static void hbqt_SlotsProxy( HBQSlots * t_slots, int id, QObject * object, void QList arrayOfTypes = meta.parameterTypes(); - // HB_TRACE( HB_TR_DEBUG, ( " SlotsProxy objectName %s ", qPrintable( object->objectName() ) ) ); - // HB_TRACE( HB_TR_DEBUG, ( " SlotsProxy className %s ", (char * ) object->metaObject()->className() ) ); int parameterCount = arrayOfTypes.size(); QStringList parList; @@ -441,7 +406,6 @@ static void hbqt_SlotsProxy( HBQSlots * t_slots, int id, QObject * object, void char cSlotName[ 20 ]; sprintf( cSlotName, "SLOT_%d", id ); int i = object->property( cSlotName ).toInt(); - // HB_TRACE( HB_TR_DEBUG, ( "SlotsProxy %s=%d", cSlotName, i ) ); if( i > 0 && i <= t_slots->listBlock.size() && hb_vmRequestReenter() ) { @@ -477,10 +441,10 @@ static void hbqt_SlotsProxy( HBQSlots * t_slots, int id, QObject * object, void case 6: // if( paramString == "QString" ) hbqt_SlotsExecString( ( PHB_ITEM * ) t_slots->listBlock.at( i - 1 ), arguments ) ; break; - case 7: // if( paramString == "QModel" ) + case 7: // if( paramString == "QModelIndex" ) hbqt_SlotsExecModel( ( PHB_ITEM * ) t_slots->listBlock.at( i - 1 ), arguments ) ; break; - case 8: // if( paramString == "QModel$QModel" ) + case 8: // if( paramString == "QModelIndex$QModelIndex" ) hbqt_SlotsExecModelModel( ( PHB_ITEM * ) t_slots->listBlock.at( i - 1 ), arguments ) ; break; case 9: // if( paramString == "QItemSelection$QItemSelection" ) @@ -525,9 +489,6 @@ static void hbqt_SlotsProxy( HBQSlots * t_slots, int id, QObject * object, void case 22: // if( paramString == "QUrl" ) hbqt_SlotsExecQUrl( ( PHB_ITEM * ) t_slots->listBlock.at( i - 1 ), arguments ) ; break; - case 23: // if( paramString == "QModel$QModel" ) - hbqt_SlotsExecModelModel( ( PHB_ITEM * ) t_slots->listBlock.at( i - 1 ), arguments ) ; - break; } } hb_vmRequestRestore(); @@ -557,103 +518,6 @@ HBQSlots::~HBQSlots() listBlock.clear(); } -bool HBQSlots::hbIsConnected( PHB_ITEM pObj, const char * slot ) -{ - HB_SYMBOL_UNUSED( pObj ); - - QObject * object = ( QObject * ) hbqt_pPtrFromObj( 1 ); - return isConnected( object, slot ); -} - -bool HBQSlots::isConnected( QObject * object, const char * slot ) -{ - int i; - - for( i = 0; i < listBlock.size(); i++ ) - { - if( listBlock[ i ] != NULL && listObj[ i ] == object ) - { - if( object->property( slot ).toInt() == i + 1 ) - { - return true; - } - } - } - return false; -} - -bool HBQSlots::hbConnect( PHB_ITEM pObj, const char * slot, PHB_ITEM bBlock ) -{ - HB_SYMBOL_UNUSED( pObj ); - HB_SYMBOL_UNUSED( bBlock ); - - QObject * object = ( QObject * ) hbqt_pPtrFromObj( 1 ); /* get sender */ - - if( object ) - { - if( !isConnected( object, slot ) ) - { -HB_TRACE( HB_TR_DEBUG, ( "AAA 3 %s %p", slot, object ) ); - bool bConnected = connect_signal( ( QString ) slot, object, this ); -HB_TRACE( HB_TR_DEBUG, ( "AAA 4" ) ); - if( bConnected ) - { - PHB_ITEM pBlock = hb_itemNew( bBlock ); /* get codeblock */ -HB_TRACE( HB_TR_DEBUG, ( "AAA 5" ) ); - listBlock << pBlock; - listObj << object; - - object->setProperty( slot, ( int ) listBlock.size() ); - - return true; - } - } - } - return false; -} - -bool HBQSlots::hbDisconnect( PHB_ITEM pObj, const char * signal ) -{ - HB_SYMBOL_UNUSED( pObj ); - - QObject * object = ( QObject* ) hbqt_pPtrFromObj( 1 ); - - if( object ) - { - int i = object->property( signal ).toInt(); - - if( i > 0 && i <= listBlock.size() ) - { - hb_itemRelease( listBlock.at( i - 1 ) ); - listBlock[ i - 1 ] = NULL; - listObj[ i - 1 ] = NULL; - - bool bRet = disconnect_signal( object, ( QString ) signal ); - - HB_TRACE( HB_TR_DEBUG, ( " QT_SLOTS_DISCONNECT: %s %s", bRet ? "YES" : "NO", signal ) ); - - return bRet; - } - } - return false; -} - -bool HBQSlots::hbClear() -{ - int i; - - for( i = 0; i < listBlock.size(); i++ ) - { - if( listBlock[ i ] != NULL ) - { - hb_itemRelease( listBlock.at( i ) ); - listBlock[ i ] = NULL; - } - } - listBlock.clear(); - return true; -} - int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void **arguments ) { id = QObject::qt_metacall( c, id, arguments ); diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.h b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.h index f1e0eda4c6..8a263a930d 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.h +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.h @@ -76,12 +76,6 @@ public: QList listObj; int qt_metacall( QMetaObject::Call call, int id, void **arguments ); - - bool hbConnect( PHB_ITEM pObj, const char * slot, PHB_ITEM bBlock ); - bool hbDisconnect( PHB_ITEM pObj, const char * slot ); - bool hbIsConnected( PHB_ITEM pObj, const char * slot ); - bool isConnected( QObject * object, const char * slot ); - bool hbClear(); }; /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtcore/qth/HBQSlots.qth b/harbour/contrib/hbqt/qtcore/qth/HBQSlots.qth index efd1a4cbf2..7c51ca1331 100644 --- a/harbour/contrib/hbqt/qtcore/qth/HBQSlots.qth +++ b/harbour/contrib/hbqt/qtcore/qth/HBQSlots.qth @@ -86,10 +86,6 @@ HB_FUNC( QT_HBQSLOTS ) -bool hbConnect( PHB_ITEM pObj, const char * slot, PHB_ITEM bBlock ) -bool hbDisconnect( PHB_ITEM obj, const char * slot ) -bool hbIsConnected( PHB_ITEM obj, const char * slot ) -bool hbClear()