2009-11-26 02:27 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)

* contrib/hbqt/hbqt_slots.cpp
  * contrib/hbqt/hbqt_slots.h

  * contrib/hbqt/qtgui/QLabel.cpp
  * contrib/hbqt/qth/QLabel.qth

  + contrib/hbide/resources/tabcmodified.png
  + contrib/hbide/resources/tabmodified.PNG
  + contrib/hbide/resources/tabreadonly.png
  + contrib/hbide/resources/tabunmodified.png

  * contrib/hbide/hbide.prg
  * contrib/hbide/ideactions.prg
    + Implemented "Find" functionality. CTRL_F or <Find> icon can be clicked.
      Input some string in "Find what" field and keep on pressing <Enter>.
    + Implemented "Print with Preview" of current source code.
    ! Document Tab Image is toggled for "Modified and UnModified" states.
    ! Fixed some more artifacts.
This commit is contained in:
Pritpal Bedi
2009-11-26 10:29:57 +00:00
parent 515aa43240
commit 9b085ea675
11 changed files with 149 additions and 38 deletions

View File

@@ -17,6 +17,26 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-11-26 02:27 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* contrib/hbqt/hbqt_slots.cpp
* contrib/hbqt/hbqt_slots.h
* contrib/hbqt/qtgui/QLabel.cpp
* contrib/hbqt/qth/QLabel.qth
+ contrib/hbide/resources/tabcmodified.png
+ contrib/hbide/resources/tabmodified.PNG
+ contrib/hbide/resources/tabreadonly.png
+ contrib/hbide/resources/tabunmodified.png
* contrib/hbide/hbide.prg
* contrib/hbide/ideactions.prg
+ Implemented "Find" functionality. CTRL_F or <Find> icon can be clicked.
Input some string in "Find what" field and keep on pressing <Enter>.
+ Implemented "Print with Preview" of current source code.
! Document Tab Image is toggled for "Modified and UnModified" states.
! Fixed some more artifacts.
2009-11-26 08:31 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/hbqt.hbc
* contrib/hbqt/hbqts.hbc

View File

@@ -122,6 +122,7 @@ CLASS HbIde
DATA qSplitterR
DATA qTabWidget
DATA qFindDlg
ACCESS qCurEdit INLINE iif( ::getCurrentTab() > 0, ::aTabs[ ::getCurrentTab(), 2 ], NIL )
/* XBP Objects */
@@ -142,6 +143,7 @@ CLASS HbIde
DATA oLinkResult
DATA oNewDlg
DATA oTabWidget
DATA oPBFind, oPBRepl, oPBClose, oFind, oRepl
DATA oCurProjItem
@@ -196,9 +198,12 @@ CLASS HbIde
DATA aComments INIT {}
METHOD createTags()
METHOD loadUI()
METHOD findReplace()
METHOD manageFocusInEditor()
METHOD convertSelection()
METHOD printPreview()
METHOD paintRequested()
METHOD setTabImage()
ENDCLASS
@@ -332,9 +337,12 @@ METHOD HbIde:create( cProjectOrSource )
::lDockRVisible := .f.
ENDIF
CASE ::mp1 == xbeK_CTRL_S
::saveSource( ::getCurrentTab(), .f. )
CASE ::mp1 == xbeK_CTRL_F
IF !empty( ::qCurEdit )
::loadUI( "finddialog" )
::findReplace( "finddialog" )
ENDIF
ENDCASE
@@ -370,6 +378,10 @@ METHOD HbIde:executeAction( cKey )
::saveSource( ::getCurrentTab(), .f. )
CASE cKey == "Close"
::closeSource()
CASE cKey == "Print"
IF !empty( ::qCurEdit )
::printPreview()
ENDIF
CASE cKey == "Undo"
IF !empty( ::qCurEdit )
::qCurEdit:undo()
@@ -396,7 +408,7 @@ METHOD HbIde:executeAction( cKey )
ENDIF
CASE cKey == "Find"
IF !empty( ::qCurEdit )
::loadUI( "finddialog" )
::findReplace( "finddialog" )
ENDIF
CASE cKey == "ToUpper"
::convertSelection( cKey )
@@ -433,6 +445,7 @@ METHOD HbIde:executeAction( cKey )
::lDockRVisible := !( ::lDockRVisible )
CASE cKey == "Compile"
CASE cKey == "CompilePPO"
ENDCASE
@@ -500,11 +513,26 @@ METHOD HbIde:updateFuncList()
/*----------------------------------------------------------------------*/
METHOD HbIde:setTabImage( cState, oTab )
LOCAL nIndex := ::qTabWidget:indexOf( QT_PTROFXBP( oTab ) )
DO CASE
CASE cState == "modified"
::qTabWidget:setTabIcon( nIndex, s_resPath + "tabmodified.png" )
CASE cState == "unmodified"
::qTabWidget:setTabIcon( nIndex, s_resPath + "tabunmodified.png" )
ENDCASE
RETURN Self
/*----------------------------------------------------------------------*/
METHOD HbIde:buildTabPage( oWnd, cSource )
LOCAL oTab, cPath, cFile, cExt
LOCAL oTab, cPath, cFile, cExt, nIndex
LOCAL aPos := { 5,5 }
LOCAL aSize := { 890, 420 }
LOCAL nIndex := len( ::aTabs )
DEFAULT cSource TO "Untitled"
@@ -516,10 +544,11 @@ METHOD HbIde:buildTabPage( oWnd, cSource )
oTab:create()
nIndex := ::qTabWidget:currentIndex()
IF lower( cExt ) $ ".c;.cpp"
::qTabWidget:setTabIcon( nIndex, s_resPath + "filec.png" )
::setTabImage( "unmodified", oTab )
ELSE
::qTabWidget:setTabIcon( nIndex, s_resPath + "fileprg.png" )
::setTabImage( "unmodified", oTab )
ENDIF
::qTabWidget:setTabTooltip( nIndex, cSource )
@@ -531,7 +560,7 @@ METHOD HbIde:buildTabPage( oWnd, cSource )
/*----------------------------------------------------------------------*/
METHOD HbIde:editSource( cSourceFile )
LOCAL oTab, qEdit, qHiliter, qLayout
LOCAL oTab, qEdit, qHiliter, qLayout, qDocument
DEFAULT cSourceFile TO ::cProjFile
@@ -565,6 +594,11 @@ METHOD HbIde:editSource( cSourceFile )
::updateFuncList()
::manageFocusInEditor()
qDocument := QTextDocument():configure( qEdit:document() )
qDocument:setModified( .f. )
Qt_Connect_Signal( QT_PTROF( qEdit ), "textChanged()", {|| ::setTabImage( "modified", oTab ) } )
RETURN Self
/*----------------------------------------------------------------------*/
@@ -676,6 +710,8 @@ METHOD HbIde:saveSource( nTab, lConfirm )
ELSE
ENDIF
ENDIF
::setTabImage( "unmodified", ::aTabs[ nTab, 1 ] )
ENDIF
RETURN Self
@@ -1016,6 +1052,30 @@ METHOD HbIde:CreateTags()
//----------------------------------------------------------------------//
METHOD HbIde:printPreview()
LOCAL qDlg
qDlg := QPrintPreviewDialog():new( QT_PTROFXBP( ::oDlg ) )
qDlg:setWindowTitle( "Harbour-QT Preview Dialog" )
Qt_Connect_Signal( qDlg:pPtr, "paintRequested(QPrinter)", {|o,p| ::paintRequested( p,o ) } )
qDlg:exec()
Qt_DisConnect_Signal( qDlg:pPtr, "paintRequested(QPrinter)" )
RETURN self
/*----------------------------------------------------------------------*/
METHOD HbIde:paintRequested( pPrinter )
LOCAL qPrinter
qPrinter := QPrinter():configure( pPrinter )
::qCurEdit:print( QT_PTROF( qPrinter ) )
RETURN Self
/*----------------------------------------------------------------------*/
METHOD HbIde:fetchProjectProperties( lNewProject )
LOCAL nRet
LOCAL qLayout, qHBLayout
@@ -1105,38 +1165,36 @@ METHOD HbIde:fetchProjectProperties( lNewProject )
/*----------------------------------------------------------------------*/
METHOD HbIde:loadUI( cUi )
METHOD HbIde:findReplace( cUi )
LOCAL qUiLoader, qFile, cUiFull
STATIC oPBFind, oPBRepl, oPBClose, qFind, qRepl
IF ::qFindDlg == NIL
cUiFull := s_resPath + cUi + ".ui"
qFile := QFile():new( cUiFull )
IF qFile:open( 1 )
qUiLoader := QUiLoader():new()
::qFindDlg := QDialog():configure( qUiLoader:load( QT_PTROF( qFile ), QT_PTROFXBP( ::oDlg ) ) )
qFile:close()
::qFindDlg:setWindowFlags( Qt_Sheet )
qFile:close()
//
oPBFind := XbpPushButton():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonFind" ) )
oPBFind:activate := {|| ::qCurEdit:find( "Harbour" ) }
::oFind := XbpComboBox():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "comboFindWhat" ) )
::oRepl := XbpComboBox():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "comboReplaceWith" ) )
oPBRepl := XbpPushButton():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonReplace" ) )
oPBRepl:activate := {|| ::qCurEdit:find( "something" ) }
::oPBFind := XbpPushButton():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonFind" ) )
::oPBFind:activate := {|| ::qCurEdit:find( QLineEdit():configure( ::oFind:oWidget:lineEdit() ):text() ) }
oPBClose := XbpPushButton():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonClose" ) )
oPBClose:activate := {|| ::qFindDlg:hide() /*done( 1 )*/ }
::oPBRepl := XbpPushButton():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonReplace" ) )
::oPBRepl:activate := {|t| t := QLineEdit():configure( ::oRepl:oWidget:lineEdit() ):text() }
qFind := XbpComboBox():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "comboFindWhat" ) )
qRepl := XbpComboBox():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "comboReplaceWith" ) )
JustACall( qFind, qRepl )
::oPBClose := XbpPushButton():new():createFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonClose" ) )
::oPBClose:activate := {|| ::qFindDlg:hide() }
ENDIF
ENDIF
::oFind:setFocus()
::qFindDlg:show()
RETURN Self
/*----------------------------------------------------------------------*/

View File

@@ -87,9 +87,10 @@ FUNCTION buildToolBar( oWnd, oIde )
oTBar:addItem( "Open" , cResPath + "open.png" , , , , , "Open" )
oTBar:addItem( "Save" , cResPath + "save.png" , , , , , "Save" )
oTBar:addItem( "Close" , cResPath + "close.png" , , , , , "Close" )
oTBar:addItem( "Print" , cResPath + "print.png" , , , , , "Print" )
oTBar:addItem( , , , , , XBPTOOLBAR_BUTTON_SEPARATOR )
oTBar:addItem( "Compile" , cResPath + "compile.png" , , , , , "Compile" )
oTBar:addItem( "Compile to PPO" , cResPath + "ppo.png" , , , , , "6" )
oTBar:addItem( "Compile to PPO" , cResPath + "ppo.png" , , , , , "CompilePPO" )
oTBar:addItem( "Build Project" , cResPath + "build.png" , , , , , "7" )
oTBar:addItem( "Build and Launch Project" , cResPath + "buildlaunch.png" , , , , , "8" )
oTBar:addItem( "Rebuild Project" , cResPath + "rebuild.png" , , , , , "9" )

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

View File

@@ -1110,8 +1110,13 @@ void Slots::tabCloseRequested( int index )
QObject *object = qobject_cast<QObject *>( sender() );
SlotsExecInt( object, ( char* ) "tabCloseRequested(int)", index );
}
void Slots::paintRequested( QPrinter * printer )
{
QObject *object = qobject_cast<QObject *>( sender() );
SlotsExecPointer( object, ( char* ) "paintRequested(QPrinter)", printer );
}
/*----------------------------------------------------------------------*/
/*
* harbour function to connect signals with slots
*/
@@ -1701,6 +1706,11 @@ HB_FUNC( QT_CONNECT_SIGNAL )
ret = object->connect( object, SIGNAL( tabCloseRequested( int ) ),
s_s, SLOT( tabCloseRequested( int ) ), Qt::AutoConnection );
}
if( signal == ( QString ) "paintRequested(QPrinter)" )
{
ret = object->connect( object, SIGNAL( paintRequested( QPrinter * ) ),
s_s, SLOT( paintRequested( QPrinter * ) ), Qt::AutoConnection );
}
hb_retl( ret );
@@ -1950,6 +1960,8 @@ bool disconnect_signal( QObject * object, const char * signal )
ret = object->disconnect( SIGNAL( currentCellChanged( int, int, int, int ) ) );
if( signal == ( QString ) "tabCloseRequested(int)" )
ret = object->disconnect( SIGNAL( tabCloseRequested( int ) ) );
if( signal == ( QString ) "paintRequested(QPrinter)" )
ret = object->disconnect( SIGNAL( paintRequested( QPrinter * ) ) );
return ret;
}

View File

@@ -324,6 +324,7 @@ public slots:
void cellPressed( int row, int column );
void currentCellChanged( int currentRow, int currentColumn, int previousRow, int previousColumn );
void tabCloseRequested( int index );
void paintRequested( QPrinter * printer );
};
class Events: public QObject

View File

@@ -96,18 +96,7 @@ QT_G_FUNC( release_QLabel )
const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject();
if( ( QString ) m->className() != ( QString ) "QObject" )
{
switch( hbqt_get_object_release_method() )
{
case HBQT_RELEASE_WITH_DELETE:
delete ( ( QLabel * ) p->ph );
break;
case HBQT_RELEASE_WITH_DESTRUTOR:
( ( QLabel * ) p->ph )->~QLabel();
break;
case HBQT_RELEASE_WITH_DELETE_LATER:
( ( QLabel * ) p->ph )->deleteLater();
break;
}
( ( QLabel * ) p->ph )->~QLabel();
p->ph = NULL;
HB_TRACE( HB_TR_DEBUG, ( "release_QLabel Object deleted!" ) );
#if defined( __HB_DEBUG__ )
@@ -148,7 +137,22 @@ HB_FUNC( QT_QLABEL )
{
void * pObj = NULL;
pObj = ( QLabel* ) new QLabel( hbqt_par_QWidget( 1 ) ) ;
if( hb_pcount() == 1 && HB_ISCHAR( 1 ) )
{
pObj = ( QLabel* ) new QLabel( hbqt_par_QString( 1 ), 0, 0 ) ;
}
else if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) )
{
pObj = ( QLabel* ) new QLabel( hbqt_par_QWidget( 1 ) ) ;
}
if( hb_pcount() == 2 && HB_ISCHAR( 1 ) && HB_ISPOINTER( 2 ) )
{
pObj = ( QLabel* ) new QLabel( hbqt_par_QString( 1 ), hbqt_par_QWidget( 2 ) ) ;
}
else
{
pObj = ( QLabel* ) new QLabel() ;
}
hb_retptrGC( gcAllocate_QLabel( pObj ) );
}

View File

@@ -70,7 +70,22 @@ New = pParent, nFlags
*/
HB_FUNC( QT_QLABEL )
{
hb_retptr( ( QLabel* ) new QLabel( hbqt_par_QWidget( 1 ) ) );
if( hb_pcount() == 1 && HB_ISCHAR( 1 ) )
{
hb_retptr( ( QLabel* ) new QLabel( hbqt_par_QString( 1 ) ) );
}
else if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) )
{
hb_retptr( ( QLabel* ) new QLabel( hbqt_par_QWidget( 1 ) ) );
}
if( hb_pcount() == 2 && HB_ISCHAR( 1 ) && HB_ISPOINTER( 2 ) )
{
hb_retptr( ( QLabel* ) new QLabel( hbqt_par_QString( 1 ), hbqt_par_QWidget( 2 ) ) );
}
else
{
hb_retptr( ( QLabel* ) new QLabel() );
}
}
</CODE>