diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 7932a87389..23a80704b7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,19 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-21 20:08 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/hbqt_hbslots.cpp + * contrib/hbqt/hbqt_hbslots.h + + Added slots for QTextBrowser() + + * contrib/hbide/ideharbourhelp.prg + + Implemented: navigation in "See Also" slot. + Functions contained in "See Also" are highlighted as a link + where single-click presents the relevant document. + + ;NOTE: "See Also" functions must ever be delimited with ",". + ;GPF: Present at exit. + 2010-02-21 18:44 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt_hbslots.cpp * contrib/hbqt/hbqt_hbslots.h diff --git a/harbour/contrib/hbide/ideharbourhelp.prg b/harbour/contrib/hbide/ideharbourhelp.prg index bca0434563..dbecc04988 100644 --- a/harbour/contrib/hbide/ideharbourhelp.prg +++ b/harbour/contrib/hbide/ideharbourhelp.prg @@ -85,6 +85,8 @@ #define editIndex_returnPressed 12 #define lostIndex_ItemDoubleClicked 13 #define buttonUp_clicked 14 +#define browserView_anchorClicked 15 +#define tabWidgetContents_currentChanged 16 /*----------------------------------------------------------------------*/ @@ -311,33 +313,38 @@ METHOD IdeHarbourHelp:setParameters() oUI:q_treeDoc:expandsOnDoubleClick( .f. ) + oUI:q_browserView:setOpenLinks( .f. ) + oUI:q_tabWidgetContents:setFocusPolicy( Qt_NoFocus ) + RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeHarbourHelp:installSignals() - ::oUI:signal( "buttonInstall" , "clicked()" , {| | ::execEvent( buttonInstall_clicked ) } ) - ::oUI:signal( "buttonHome" , "clicked()" , {| | ::execEvent( buttonHome_clicked ) } ) - ::oUI:signal( "buttonBackward", "clicked()" , {| | ::execEvent( buttonBackward_clicked ) } ) - ::oUI:signal( "buttonForward" , "clicked()" , {| | ::execEvent( buttonForward_clicked ) } ) - ::oUI:signal( "buttonUp" , "clicked()" , {| | ::execEvent( buttonUp_clicked ) } ) - ::oUI:signal( "buttonRefresh" , "clicked()" , {| | ::execEvent( buttonRefresh_clicked ) } ) - ::oUI:signal( "buttonPrint" , "clicked()" , {| | ::execEvent( buttonPrint_clicked ) } ) - ::oUI:signal( "buttonPdf" , "clicked()" , {| | ::execEvent( buttonPdf_clicked ) } ) - ::oUI:signal( "editInstall" , "textChanged(QString)" , {|p | ::execEvent( editInstall_textChanged, p ) } ) - ::oUI:signal( "editIndex" , "textChanged(QString)" , {|p | ::execEvent( editIndex_textChanged, p ) } ) - ::oUI:signal( "editIndex" , "returnPressed()" , {| | ::execEvent( editIndex_returnPressed ) } ) - ::oUI:signal( "listIndex" , "itemDoubleClicked(QLWItem)", {|p | ::execEvent( lostIndex_ItemDoubleClicked, p ) } ) + ::oUI:signal( "buttonInstall" , "clicked()" , {| | ::execEvent( buttonInstall_clicked ) } ) + ::oUI:signal( "buttonHome" , "clicked()" , {| | ::execEvent( buttonHome_clicked ) } ) + ::oUI:signal( "buttonBackward", "clicked()" , {| | ::execEvent( buttonBackward_clicked ) } ) + ::oUI:signal( "buttonForward" , "clicked()" , {| | ::execEvent( buttonForward_clicked ) } ) + ::oUI:signal( "buttonUp" , "clicked()" , {| | ::execEvent( buttonUp_clicked ) } ) + ::oUI:signal( "buttonRefresh" , "clicked()" , {| | ::execEvent( buttonRefresh_clicked ) } ) + ::oUI:signal( "buttonPrint" , "clicked()" , {| | ::execEvent( buttonPrint_clicked ) } ) + ::oUI:signal( "buttonPdf" , "clicked()" , {| | ::execEvent( buttonPdf_clicked ) } ) + ::oUI:signal( "editInstall" , "textChanged(QString)" , {|p| ::execEvent( editInstall_textChanged, p ) } ) + ::oUI:signal( "editIndex" , "textChanged(QString)" , {|p| ::execEvent( editIndex_textChanged, p ) } ) + ::oUI:signal( "editIndex" , "returnPressed()" , {| | ::execEvent( editIndex_returnPressed ) } ) + ::oUI:signal( "listIndex" , "itemDoubleClicked(QLWItem)", {|p| ::execEvent( lostIndex_ItemDoubleClicked, p ) } ) + ::oUI:signal( "browserView" , "anchorClicked(QUrl)" , {|p| ::execEvent( browserView_anchorClicked, p ) } ) + ::oUI:signal( "tabWidgetContents", "currentChanged(int)" , {|p| ::execEvent( tabWidgetContents_currentChanged, p ) } ) - ::connect( ::oUI:q_treeDoc , "itemSelectionChanged()" , {| | ::execEvent( treeDoc_itemSelectionChanged ) } ) + ::connect( ::oUI:q_treeDoc , "itemSelectionChanged()" , {| | ::execEvent( treeDoc_itemSelectionChanged ) } ) RETURN Self /*----------------------------------------------------------------------*/ METHOD IdeHarbourHelp:execEvent( nMode, p, p1 ) - LOCAL cPath, qTWItem, cText, n, nn, nLen, cLower + LOCAL cPath, qTWItem, cText, n, nn, nLen, cLower, qUrl HB_SYMBOL_UNUSED( p1 ) @@ -350,9 +357,26 @@ METHOD IdeHarbourHelp:execEvent( nMode, p, p1 ) ENDIF EXIT + CASE tabWidgetContents_currentChanged + IF p == 1 + ::oUI:q_editIndex:setFocus_1() + ENDIF + EXIT + + CASE browserView_anchorClicked + qUrl := QUrl():from( p ) + cText := lower( qUrl:toString() ) + nLen := len( cText ) + IF ( n := ascan( ::aFunctions, {|e_| left( e_[ 6 ], nLen ) == cText } ) ) > 0 + ::oUI:q_listIndex:setCurrentItem( ::aFunctions[ n, 5 ] ) + ::populateIndexedSelection() + ENDIF + EXIT + CASE lostIndex_ItemDoubleClicked CASE editIndex_returnPressed ::populateIndexedSelection() + ::oUI:q_editIndex:setFocus_1() EXIT CASE editIndex_textChanged @@ -787,7 +811,7 @@ METHOD IdeHarbourHelp:populateFuncDetails( n ) /*----------------------------------------------------------------------*/ METHOD IdeHarbourHelp:buildView( oFunc ) - LOCAL s, x, y, v, w, z + LOCAL s, x, y, v, w, z, n, s1, a_ LOCAL aHtm := {} aadd( aHtm, "" ) @@ -841,29 +865,45 @@ METHOD IdeHarbourHelp:buildView( oFunc ) v := '
'                    ; w := "
" z := " " - aadd( aHtm, x + "Syntax" + y ) + aadd( aHtm, x + "Syntax" + y ) aadd( aHtm, v + hbide_arrayToMemoHtml( oFunc:aSyntax ) + w ) aadd( aHtm, z ) - aadd( aHtm, x + "Arguments" + y ) + aadd( aHtm, x + "Arguments" + y ) aadd( aHtm, v + hbide_arrayToMemoHtml( oFunc:aArguments ) + w ) aadd( aHtm, z ) - aadd( aHtm, x + "Returns" + y ) + aadd( aHtm, x + "Returns" + y ) aadd( aHtm, v + hbide_arrayToMemoHtml( oFunc:aReturns ) + w ) aadd( aHtm, z ) - aadd( aHtm, x + "Description" + y ) + aadd( aHtm, x + "Description" + y ) aadd( aHtm, v + hbide_arrayToMemoHtml( oFunc:aDescription ) + w ) aadd( aHtm, z ) - aadd( aHtm, x + "Examples" + y ) + aadd( aHtm, x + "Examples" + y ) aadd( aHtm, v + hbide_arrayToMemoHtml( oFunc:aExamples ) + w ) aadd( aHtm, z ) - aadd( aHtm, x + "Files" + y ) + aadd( aHtm, x + "Files" + y ) aadd( aHtm, v + hbide_arrayToMemoHtml( oFunc:aFiles ) + w ) aadd( aHtm, z ) - aadd( aHtm, x + "Platforms" + y ) + aadd( aHtm, x + "SeeAlso" + y ) + aadd( aHtm, "" ) + a_:= hb_atokens( oFunc:cSeaAlso, "," ) + IF !empty( a_ ) + FOR EACH s IN a_ + IF ( n := at( "(", s ) ) > 0 + s1 := substr( s, 1, n-1 ) + aadd( aHtm, '' + s + "" + ; + iif( s:__enumIndex() == len( a_ ), "", ", " ) ) + ENDIF + NEXT + ELSE + aadd( aHtm, " " ) + ENDIF + aadd( aHtm, "" ) + aadd( aHtm, z ) + aadd( aHtm, x + "Platforms" + y ) aadd( aHtm, v + oFunc:cPlatforms + w ) aadd( aHtm, z ) - aadd( aHtm, x + "Status" + y ) - aadd( aHtm, v + oFunc:cStatus + w ) + aadd( aHtm, x + "Status" + y ) + aadd( aHtm, v + oFunc:cStatus + w ) aadd( aHtm, z ) aadd( aHtm, " " ) diff --git a/harbour/contrib/hbqt/hbqt_hbslots.cpp b/harbour/contrib/hbqt/hbqt_hbslots.cpp index 958724969b..ca56fc7607 100644 --- a/harbour/contrib/hbqt/hbqt_hbslots.cpp +++ b/harbour/contrib/hbqt/hbqt_hbslots.cpp @@ -208,6 +208,15 @@ static bool connect_signal( QString signal, QObject * object, HBSlots * t_slots else if( signal == ( QString ) "itemDoubleClicked(QLWItem)" ) ret = object->connect( object, SIGNAL( itemDoubleClicked( QListWidgetItem * ) ), t_slots, SLOT( itemDoubleClicked( QListWidgetItem * ) ), Qt::AutoConnection ); else if( signal == ( QString ) "itemEntered(QLWItem)" ) ret = object->connect( object, SIGNAL( itemEntered( QListWidgetItem * ) ), t_slots, SLOT( itemEntered( QListWidgetItem * ) ), Qt::AutoConnection ); else if( signal == ( QString ) "itemPressed(QLWItem)" ) ret = object->connect( object, SIGNAL( itemPressed( QListWidgetItem * ) ), t_slots, SLOT( itemPressed( QListWidgetItem * ) ), Qt::AutoConnection ); + /* QTextBrowser */ + else if( signal == ( QString ) "anchorClicked(QUrl)" ) ret = object->connect( object, SIGNAL( anchorClicked( const QUrl & ) ), t_slots, SLOT( anchorClicked( const QUrl & ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "backwardAvailable(bool)" ) ret = object->connect( object, SIGNAL( backwardAvailable( bool ) ), t_slots, SLOT( backwardAvailable( bool ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "forwardAvailable(bool)" ) ret = object->connect( object, SIGNAL( forwardAvailable( bool ) ), t_slots, SLOT( forwardAvailable( bool ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "highlighted(QUrl)" ) ret = object->connect( object, SIGNAL( highlighted( const QUrl & ) ), t_slots, SLOT( highlighted( const QUrl & ) ), Qt::AutoConnection ); + //else if( signal == ( QString ) "highlighted(QString)" ) ret = object->connect( object, SIGNAL( highlighted( const QString & ) ), t_slots, SLOT( highlighted( const QString & ) ), Qt::AutoConnection ); + else if( signal == ( QString ) "historyChanged()" ) ret = object->connect( object, SIGNAL( historyChanged() ), t_slots, SLOT( historyChanged() ), Qt::AutoConnection ); + else if( signal == ( QString ) "sourceChanged(QUrl)" ) ret = object->connect( object, SIGNAL( sourceChanged( const QUrl & ) ), t_slots, SLOT( sourceChanged( const QUrl & ) ), Qt::AutoConnection ); + /* New */ else ret = false; return ret; @@ -350,7 +359,15 @@ static bool disconnect_signal( QObject * object, const char * signal ) else if( signal == ( QString ) "itemDoubleClicked(QLWItem)" ) return object->disconnect( SIGNAL( itemDoubleClicked( QListWidgetItem * ) ) ); else if( signal == ( QString ) "itemEntered(QLWItem)" ) return object->disconnect( SIGNAL( itemEntered( QListWidgetItem * ) ) ); else if( signal == ( QString ) "itemPressed(QLWItem)" ) return object->disconnect( SIGNAL( itemPressed( QListWidgetItem * ) ) ); - + /* QTextBrowser */ + else if( signal == ( QString ) "anchorClicked(QUrl)" ) return object->disconnect( SIGNAL( anchorClicked( const QUrl & ) ) ); + else if( signal == ( QString ) "backwardAvailable(bool)" ) return object->disconnect( SIGNAL( backwardAvailable( bool ) ) ); + else if( signal == ( QString ) "forwardAvailable(bool)" ) return object->disconnect( SIGNAL( forwardAvailable( bool ) ) ); + else if( signal == ( QString ) "highlighted(QUrl)" ) return object->disconnect( SIGNAL( highlighted( const QUrl & ) ) ); + //else if( signal == ( QString ) "highlighted(QString)" ) return object->disconnect( SIGNAL( highlighted( const QString & ) ) ); + else if( signal == ( QString ) "historyChanged()" ) return object->disconnect( SIGNAL( historyChanged() ) ); + else if( signal == ( QString ) "sourceChanged(QUrl)" ) return object->disconnect( SIGNAL( sourceChanged( const QUrl & ) ) ); + /* new */ return false; } @@ -672,6 +689,22 @@ static void hbqt_SlotsExecQPoint( HBSlots * t_slots, QObject * object, const cha } } +static void hbqt_SlotsExecQUrl( HBSlots * t_slots, QObject * object, const char * pszEvent, const QUrl & link ) +{ + if( object ) + { + int i = object->property( pszEvent ).toInt(); + if( i > 0 && i <= t_slots->listBlock.size() && hb_vmRequestReenter() ) + { + PHB_ITEM p1 = hb_itemPutPtr( NULL, ( QUrl * ) new QUrl( link ) ); + hb_vmEvalBlockV( t_slots->listBlock.at( i - 1 ), 1, p1 ); + delete ( ( QUrl * ) hb_itemGetPtr( p1 ) ); + hb_itemRelease( p1 ); + hb_vmRequestRestore(); + } + } +} + HBSlots::HBSlots( QObject* parent ) : QObject( parent ) { } @@ -929,28 +962,14 @@ void HBSlots::itemClicked( QListWidgetItem * item ) void HBSlots::itemDoubleClicked( QListWidgetItem * item ) { hbqt_SlotsExecPointer( this, qobject_cast( sender() ), "itemDoubleClicked(QLWItem)", item ); } void HBSlots::itemEntered( QListWidgetItem * item ) { hbqt_SlotsExecPointer( this, qobject_cast( sender() ), "itemEntered(QLWItem)", item ); } void HBSlots::itemPressed( QListWidgetItem * item ) { hbqt_SlotsExecPointer( this, qobject_cast( sender() ), "itemPressed(QLWItem)", item ); } - -#if 0 -currentItemChanged( QListWidgetItem *, QListWidgetItem * ) -currentRowChanged( int ) -currentTextChanged( const QString & ) -itemActivated( QListWidgetItem * ) -itemChanged( QListWidgetItem * ) -itemClicked( QListWidgetItem * ) -itemDoubleClicked( QListWidgetItem * ) -itemEntered( QListWidgetItem * ) -itemPressed( QListWidgetItem * ) - -"currentItemChanged(QLWItem,QLWItem)" -"currentRowChanged(currentRow)" -"currentTextChanged(QString)" -"itemActivated(QLWItem)" -"itemChanged(QLWItem)" -"itemClicked(QLWItem)" -"itemDoubleClicked(QLWItem)" -"itemEntered(QLWItem)" -"itemPressed(QLWItem)" -#endif +/* QTextBrowser */ +void HBSlots::anchorClicked( const QUrl & link ) { hbqt_SlotsExecQUrl( this, qobject_cast( sender() ), "anchorClicked(QUrl)", link ); } +void HBSlots::backwardAvailable( bool available ) { hbqt_SlotsExecBool( this, qobject_cast( sender() ), "backwardAvailable(bool)", available ); } +void HBSlots::forwardAvailable( bool available ) { hbqt_SlotsExecBool( this, qobject_cast( sender() ), "forwardAvailable(bool)", available ); } +void HBSlots::highlighted( const QUrl & link ) { hbqt_SlotsExecQUrl( this, qobject_cast( sender() ), "highlighted(QUrl)", link ); } +//void HBSlots::highlighted( const QString & link ) { hbqt_SlotsString( this, qobject_cast( sender() ), "highlighted(QString)", link ); } +void HBSlots::historyChanged() { hbqt_SlotsExec( this, qobject_cast( sender() ), "historyChanged()" ); } +void HBSlots::sourceChanged( const QUrl & src ) { hbqt_SlotsExecQUrl( this, qobject_cast( sender() ), "sourceChanged(QUrl)", src ); } /*----------------------------------------------------------------------*/ /* diff --git a/harbour/contrib/hbqt/hbqt_hbslots.h b/harbour/contrib/hbqt/hbqt_hbslots.h index 0ad74c2552..5f63e981b1 100644 --- a/harbour/contrib/hbqt/hbqt_hbslots.h +++ b/harbour/contrib/hbqt/hbqt_hbslots.h @@ -58,6 +58,7 @@ #include "hbapiitm.h" #include +#include #include #include #include @@ -253,7 +254,15 @@ public slots: void itemDoubleClicked( QListWidgetItem * item ); void itemEntered( QListWidgetItem * item ); void itemPressed( QListWidgetItem * item ); - /* */ + /* QTextBrowser */ + void anchorClicked( const QUrl & link ); + void backwardAvailable( bool available ); + void forwardAvailable( bool available ); + void highlighted( const QUrl & link ); + // void highlighted( const QString & link ); + void historyChanged(); + void sourceChanged( const QUrl & src ); + /* */ }; /*----------------------------------------------------------------------*/