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.
This commit is contained in:
Pritpal Bedi
2010-02-22 06:15:01 +00:00
parent 68a8533193
commit ee61581a8f
4 changed files with 129 additions and 48 deletions

View File

@@ -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

View File

@@ -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, "<HTML>" )
@@ -841,29 +865,45 @@ METHOD IdeHarbourHelp:buildView( oFunc )
v := '<TR><TD margin-left: 20px><pre>' ; w := "</pre></TD></TR>"
z := "<TR><TD>&nbsp;</TD></TR>"
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, "<TR><TD>" )
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, '<a href="' + s1 + '">' + s + "</a>" + ;
iif( s:__enumIndex() == len( a_ ), "", ",&nbsp;" ) )
ENDIF
NEXT
ELSE
aadd( aHtm, "&nbsp;" )
ENDIF
aadd( aHtm, "</TD></TR>" )
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, " </TABLE>" )

View File

@@ -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<QObject *>( sender() ), "itemDoubleClicked(QLWItem)", item ); }
void HBSlots::itemEntered( QListWidgetItem * item ) { hbqt_SlotsExecPointer( this, qobject_cast<QObject *>( sender() ), "itemEntered(QLWItem)", item ); }
void HBSlots::itemPressed( QListWidgetItem * item ) { hbqt_SlotsExecPointer( this, qobject_cast<QObject *>( 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<QObject *>( sender() ), "anchorClicked(QUrl)", link ); }
void HBSlots::backwardAvailable( bool available ) { hbqt_SlotsExecBool( this, qobject_cast<QObject *>( sender() ), "backwardAvailable(bool)", available ); }
void HBSlots::forwardAvailable( bool available ) { hbqt_SlotsExecBool( this, qobject_cast<QObject *>( sender() ), "forwardAvailable(bool)", available ); }
void HBSlots::highlighted( const QUrl & link ) { hbqt_SlotsExecQUrl( this, qobject_cast<QObject *>( sender() ), "highlighted(QUrl)", link ); }
//void HBSlots::highlighted( const QString & link ) { hbqt_SlotsString( this, qobject_cast<QObject *>( sender() ), "highlighted(QString)", link ); }
void HBSlots::historyChanged() { hbqt_SlotsExec( this, qobject_cast<QObject *>( sender() ), "historyChanged()" ); }
void HBSlots::sourceChanged( const QUrl & src ) { hbqt_SlotsExecQUrl( this, qobject_cast<QObject *>( sender() ), "sourceChanged(QUrl)", src ); }
/*----------------------------------------------------------------------*/
/*

View File

@@ -58,6 +58,7 @@
#include "hbapiitm.h"
#include <QtCore/QProcess>
#include <QtCore/QUrl>
#include <QtGui/QTextCursor>
#include <QtGui/QTextCharFormat>
#include <QtGui/QTreeWidgetItem>
@@ -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 );
/* */
};
/*----------------------------------------------------------------------*/