diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 04daab9a04..7522af095b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,45 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-04-16 07:49 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/qth/QApplication.qth + * contrib/hbqt/qth/QLayout.qth + + * contrib/hbqt/generator/hbqtgen.prg + * contrib/hbqt/hbqt_hbslots.cpp + + * contrib/hbxbp/hbpprocess.prg + * contrib/hbxbp/xbpgeneric.prg + * contrib/hbxbp/xbprtf.prg + * contrib/hbxbp/xbpstatic.prg + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/idefunctions.prg + * contrib/hbide/idemisc.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/ideshortcuts.prg + * contrib/hbide/idetools.prg + + + This commit includes Francesco Perillo's patch, after applying some + formatting and leaving what did not worked. + + Includes Istvan's concept of child detachment, but not made active still. + - Deleted many objects which were created in early days of hbIDE development. + + Changed the way QApplication's init/exit procedures were implemented. + Now the behavior is accurate. + + Applied some more control over object destruction placement. + + Plus a lot of optimizations I cannot jot down exactly. + + Basically, this commit aims at locating the GPF at exit. Now instead of + GPF, we receive two RTE's at the end, if exiting hbIDE at the quick + succession. But if you have worked into it for few seconds, it exits + normally. Please test. + + David, the QPixmap bug in hbXBP on OS2 was a bug in hbXBP and is fixed. + You can test it again to verify if I am correct. + 2010-04-16 07:28 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/qtcore/*.cpp * contrib/hbqt/qtgui/*.cpp diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 66290dd8b1..a2a4139bb3 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -160,7 +160,6 @@ CLASS HbIde DATA qFindDlg - DATA qCursor DATA qFontWrkProject DATA qBrushWrkProject DATA qProcess @@ -332,7 +331,7 @@ HB_TRACE( HB_TR_ALWAYS, "HbIde:create( cProjIni )", "#Params=" ) qSplash:setPixmap( qPixmap ) qSplash:show() ::showApplicationCursor( Qt_BusyCursor ) - QApplication():processEvents() + QApplication():new():processEvents() /* Initiate the place holders */ ::aINI := array( INI_SECTIONS_COUNT ) @@ -433,10 +432,6 @@ HB_TRACE( HB_TR_ALWAYS, "HbIde:create( cProjIni )", "#Params=" ) /* Home Implementation */ ::oHM := IdeHome():new():create( Self ) - /* Just to spare some GC calls */ - ::qCursor := QTextCursor():new() - ::qBrushWrkProject := QBrush():new( "QColor", QColor():new( 255,0,0 ) ) - /* Fill various elements of the IDE */ ::cWrkProject := ::aINI[ INI_HBIDE, CurrentProject ] ::oPM:populate() @@ -452,10 +447,6 @@ HB_TRACE( HB_TR_ALWAYS, "HbIde:create( cProjIni )", "#Params=" ) /* Set some last settings */ ::oPM:setCurrentProject( ::cWrkProject, .f. ) - /* Set components Sizes */ - * ::setSizeByIni( ::oProjTree:oWidget, ProjectTreeGeometry ) - * ::setSizeByIni( ::oEditTree:oWidget, ProjectTreeGeometry ) - /* Restore Settings */ hbide_restSettings( Self ) /* Again to be displayed in Statusbar */ @@ -485,7 +476,7 @@ HB_TRACE( HB_TR_ALWAYS, "HbIde:create( cProjIni )", "#Params=" ) IF seconds() > n + 10 EXIT ENDIF - QApplication():processEvents() + QApplication():new():processEvents() ENDDO #endif @@ -505,7 +496,6 @@ HB_TRACE( HB_TR_ALWAYS, "HbIde:create( cProjIni )", "#Params=" ) ::showApplicationCursor() qSplash:close() - //qSplash := NIL /* Load tags last tagged projects */ ::oFN:loadTags( ::aINI[ INI_TAGGEDPROJECTS ] ) @@ -587,8 +577,8 @@ HB_TRACE( HB_TR_ALWAYS, "HbIde:create( cProjIni )", "#Params=" ) ::oDlg:destroy() ::oAC:destroy() - ::qCursor := NIL - ::oFont := NIL + ::oFont := NIL + qSplash := NIL HB_TRACE( HB_TR_ALWAYS, " " ) HB_TRACE( HB_TR_ALWAYS, "After ::oDlg:destroy()", memory( 1001 ) ) @@ -642,13 +632,13 @@ METHOD HbIde:parseParams() METHOD HbIde:showApplicationCursor( nCursor ) - STATIC qCrs + LOCAL qCrs IF empty( nCursor ) - QApplication():restoreOverrideCursor() + QApplication():new():restoreOverrideCursor() ELSE qCrs := QCursor():new( nCursor ) - QApplication():setOverrideCursor( qCrs ) + QApplication():new():setOverrideCursor( qCrs ) ENDIF RETURN Self diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index f8c3d3af1f..a094dc4186 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -152,6 +152,9 @@ METHOD IdeDocks:create( oIde ) METHOD IdeDocks:destroy() LOCAL qTBtn + ::oIde:oProjRoot := NIL + ::oIde:oOpenedSources := NIL + ::disconnect( ::oOutputResult:oWidget , "copyAvailable(bool)" ) ::disconnect( ::oEnvironDock:oWidget , "visibilityChanged(bool)" ) @@ -470,10 +473,7 @@ METHOD IdeDocks:buildSearchReplaceWidget() METHOD IdeDocks:buildToolBarPanels() LOCAL s, qTBtn, a_, aBtns, qAct - - STATIC qSize - - qSize := QSize():new( 20,20 ) + LOCAL qSize := QSize():new( 20,20 ) /* Toolbar Panels */ diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 7804965708..b76bc0430b 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -220,6 +220,8 @@ METHOD IdeEditsManager:destroy() LOCAL a_ ::disconnect( ::qCompleter, "activated(QString)" ) + ::oIde:qCompModel := NIL + ::oIde:qProtoList := NIL ::oIde:qCompleter := NIL FOR EACH a_ IN ::aActions @@ -978,11 +980,9 @@ CLASS IdeEditor INHERIT IdeObject DATA qHLayout DATA qLabel DATA nnRow INIT -99 - DATA qPoint INIT QPoint():new() DATA qEvents - DATA qSlots - DATA qMarkLayoutOld +// DATA qSlots METHOD new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) METHOD create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) @@ -1028,7 +1028,7 @@ METHOD IdeEditor:new( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView ) LOCAL cFileTemp - ::qSlots := HBSlots():new() + //::qSlots := HBSlots():new() DEFAULT oIde TO ::oIde DEFAULT cSourceFile TO ::sourceFile @@ -1390,23 +1390,11 @@ CLASS IdeEdit INHERIT IdeObject DATA nMaxDigits INIT 5 // Tobe DATA nMaxRows INIT 100 DATA nLastLine INIT -99 - DATA qBlockFormat INIT QTextBlockFormat():new() DATA nCurLineNo INIT 0 DATA nPrevLineNo INIT -1 - DATA qPoint INIT QPoint():new( 0,0 ) - DATA qBrushCL INIT QBrush():new( "QColor", QColor():new( 240,240,240 ) ) - DATA qBrushNR INIT QBrush():new( "QColor", QColor():new( 255,255,255 ) ) - DATA qBrushMark INIT QBrush():new( "QColor", QColor():new( 0,255,255 ) ) - DATA qActionTab - DATA qLastCursor INIT QTextCursor():new() - DATA qSelColor INIT QColor():new( 255,0,255 ) - - DATA qCursorMark - DATA qMarkUData INIT HBQTextBlockUserData():new() DATA aBookMarks INIT {} - DATA qSlots DATA lModified INIT .F. DATA lIndentIt INIT .f. DATA lUpdatePrevWord INIT .f. diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index 5351d4e71b..5cce53fc7f 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -610,8 +610,6 @@ METHOD IdeFindInFiles:destroy() LOCAL qItem IF !empty( ::oUI ) - ::disconnect( ::oUI:oWidget, "rejected()" ) - FOR EACH qItem IN ::aItems qItem := NIL NEXT @@ -1216,7 +1214,7 @@ METHOD IdeFindInFiles:showLog( nType, cMsg, aLines ) qCursor:movePosition( QTextCursor_Down ) ::oUI:q_editResults:setTextCursor( qCursor ) - QApplication():processEvents() + QApplication():new():processEvents() RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idefunctions.prg b/harbour/contrib/hbide/idefunctions.prg index 25cf1fa046..d8b0391c5a 100644 --- a/harbour/contrib/hbide/idefunctions.prg +++ b/harbour/contrib/hbide/idefunctions.prg @@ -194,8 +194,9 @@ METHOD IdeFunctions:execEvent( nMode, p ) CASE nMode == tableFuncList_itemSelectionChanged n := ::oUI:q_tableFuncList:currentRow() - ::oUI:q_editSyntax:setText( ::aList[ n + 1, 2 ] ) - + IF n >= 0 + ::oUI:q_editSyntax:setText( ::aList[ n + 1, 2 ] ) + ENDIF ENDCASE RETURN Self @@ -462,7 +463,7 @@ METHOD IdeFunctions:loadTags( aProjects ) ENDIF ENDIF - QApplication():processEvents() + QApplication():new():processEvents() NEXT IF lPopulate @@ -532,7 +533,7 @@ METHOD IdeFunctions:tagProject( cProjectTitle ) ENDIF ENDIF - QApplication():processEvents() + QApplication():new():processEvents() NEXT FOR EACH a_ IN aCTags @@ -607,7 +608,7 @@ METHOD IdeFunctions:populateTable() oTbl:setItem( n, 0, qItm ) oTbl:setRowHeight( n, 16 ) - QApplication():processEvents() + QApplication():new():processEvents() aadd( ::aItems, qItm ) n++ diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 277ff98422..aa288c11cf 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -1627,11 +1627,13 @@ FUNCTION hbide_fetchSubPaths( aPaths, cRootPath, lSubs ) /*----------------------------------------------------------------------*/ FUNCTION hbide_image( cName ) + DEFAULT cName TO "" RETURN hbide_pathToOsPath( hb_DirBase() + "resources" + "/" + cName + ".png" ) /*----------------------------------------------------------------------*/ FUNCTION hbide_uic( cName ) + DEFAULT cName TO "" RETURN hbide_pathToOsPath( hb_DirBase() + "resources" + "/" + cName + ".uic" ) /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index c680c62f2b..1d49d1eed7 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -896,7 +896,8 @@ METHOD IdeProjManager:setCurrentProject( cProjectName ) /* Set New Color */ IF !empty( ::cWrkProject ) IF !empty( oItem := hbide_findProjTreeItem( ::oIDE, ::cWrkProject, "Project Name" ) ) - oItem:oWidget:setForeground( 0, ::qBrushWrkProject ) + //oItem:oWidget:setForeground( 0, ::qBrushWrkProject ) + oItem:oWidget:setForeground( 0, QBrush():new( "QColor", QColor():new( 255,0,0 ) ) ) //oItem:oWidget:setBackground( 0, ::qBrushWrkProject ) //hbide_expandChildren( ::oIDE, oItem ) ::oProjTree:oWidget:setCurrentItem( oItem:oWidget ) @@ -1312,7 +1313,7 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) ::outputText( "" + "Executable could not been detected from linker output!" + "" ) ELSE cExe := alltrim( cExe ) - ::outputText( "" + "Detected exeutable => " + cExe + " " + hb_ntos( len( cExe ) ) + "" ) + ::outputText( "" + "Detected exeutable => " + cExe + "" ) ENDIF ::outputText( " " ) @@ -1334,7 +1335,8 @@ METHOD IdeProjManager:finished( nExitCode, nExitStatus, oProcess ) * 03/01/2010 - 09:24:50 */ METHOD IdeProjManager:launchProject( cProject, cExe ) - LOCAL cTargetFN, cTmp, oProject, qProcess, qStr + LOCAL cTargetFN, cTmp, oProject + LOCAL qProcess, qStr IF empty( cProject ) cProject := ::oPM:getCurrentProject() @@ -1384,18 +1386,23 @@ METHOD IdeProjManager:launchProject( cProject, cExe ) ELSEIF oProject:type == "Executable" cTmp := "Launching application [ " + cTargetFN + " ]" - qProcess := QProcess():new() - qProcess:setWorkingDirectory( hbide_pathToOSPath( oProject:wrkDirectory ) ) - IF !empty( oProject:launchParams ) - qStr := QStringList():new() - qStr:append( oProject:launchParams ) - qProcess:startDetached_1( cTargetFN, qStr ) - ELSE - qProcess:startDetached_2( cTargetFN ) - ENDIF - qProcess:waitForStarted() - qProcess := NIL + if .t. + qProcess := QProcess():new() + qProcess:setWorkingDirectory( hbide_pathToOSPath( oProject:wrkDirectory ) ) + IF !empty( oProject:launchParams ) + qStr := QStringList():new() + qStr:append( oProject:launchParams ) + qProcess:startDetached_1( cTargetFN, qStr ) + ELSE + qProcess:startDetached_2( cTargetFN ) + ENDIF + qProcess:waitForStarted() + qProcess := NIL + else + hb_processRun( cTargetFN, , , , .t. ) + + endif ELSE cTmp := "Launching application [ " + cTargetFN + " ] ( not applicable )." diff --git a/harbour/contrib/hbide/ideshortcuts.prg b/harbour/contrib/hbide/ideshortcuts.prg index 0ca897a72f..514207de43 100644 --- a/harbour/contrib/hbide/ideshortcuts.prg +++ b/harbour/contrib/hbide/ideshortcuts.prg @@ -257,6 +257,9 @@ METHOD IdeShortcuts:execEvent( nMode, p ) ::clearDftSCuts() ::populateDftSCuts() ENDIF + IF nRow <= len( ::aDftSCuts ) + ::oUI:q_tableMacros:setCurrentCell( nRow - 1, 0 ) + ENDIF ENDIF EXIT CASE buttonTest_clicked @@ -297,10 +300,10 @@ METHOD IdeShortcuts:execEvent( nMode, p ) ::controls2vrbls() IF !empty( ::cName ) IF !( ::checkDuplicate( ::cKey, ::cAlt, ::cCtrl, ::cShift ) ) - aadd( ::aDftSCuts, { ::cName, ::cKey, ::cAlt, ::cCtrl, ::cShift, ::cMenu, ::cBlock } ) - aadd( ::aDftSCutsItms, array( 5 ) ) + aadd( ::aDftSCuts, { ::cName, ::cKey, ::cAlt, ::cCtrl, ::cShift, ::cMenu, ::cBlock, ::cIcon } ) + aadd( ::aDftSCutsItms, array( 6 ) ) ::oUI:q_tableMacros:setRowCount( ::oUI:q_tableMacros:rowCount() + 1 ) - ::array2table( len( ::aDftSCuts ), { ::cName, ::cKey, ::cAlt, ::cCtrl, ::cShift, ::cMenu, ::cBlock } ) + ::array2table( len( ::aDftSCuts ), { ::cName, ::cKey, ::cAlt, ::cCtrl, ::cShift, ::cMenu, ::cBlock, ::cIcon } ) ELSE MsgBox( "Current shortcut is already defined!" ) ENDIF @@ -582,7 +585,7 @@ METHOD IdeShortcuts:populateDftSCuts() nRow++ aadd( ::aDftSCutsItms, array( 6 ) ) ::array2table( nRow, a_ ) - QApplication():processEvents() + QApplication():new():processEvents() NEXT oTbl:setCurrentCell( 0,0 ) @@ -661,7 +664,7 @@ METHOD IdeShortcuts:test( cString, lWarn ) MsgBox( "Script compiles fine!", "Syntax checking", , , , bBlock ) ENDIF RECOVER USING oErr - MsgBox( "Wrongly defined script, syntax is |v| ::method( v )" + oErr:description ) + MsgBox( "Wrongly defined script, try: |v| ::method( v )", oErr:description ) ENDSEQUENCE ErrorBlock( bError ) diff --git a/harbour/contrib/hbide/idetools.prg b/harbour/contrib/hbide/idetools.prg index cea9c0bc64..dc331c598e 100644 --- a/harbour/contrib/hbide/idetools.prg +++ b/harbour/contrib/hbide/idetools.prg @@ -146,11 +146,16 @@ METHOD IdeToolsManager:destroy() ::disconnect( qAct, "triggered(bool)" ) qAct := NIL NEXT + FOR EACH qAct IN ::aPanelsAct + ::disconnect( qAct, "triggered(bool)" ) + qAct := NIL + NEXT ::disconnect( ::qToolsButton, "clicked()" ) ::qToolsButton := NIL - ::clearList() + ::disconnect( ::qPanelsButton, "clicked()" ) + ::disconnect( ::oUI:q_buttonAdd , "clicked()" ) ::disconnect( ::oUI:q_buttonDelete, "clicked()" ) ::disconnect( ::oUI:q_buttonUp , "clicked()" ) diff --git a/harbour/contrib/hbqt/generator/hbqtgen.prg b/harbour/contrib/hbqt/generator/hbqtgen.prg index 84303a1355..5f00a70151 100644 --- a/harbour/contrib/hbqt/generator/hbqtgen.prg +++ b/harbour/contrib/hbqt/generator/hbqtgen.prg @@ -410,6 +410,8 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) s_isObject := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "qobject" .and. lower( e_[ 2 ] ) == "no"} ) == 0 /* Body */ + lList := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "list" .AND. lower( e_[ 2 ] ) == "yes" } ) > 0 + FOR EACH s IN protos_ cOrg := s @@ -441,7 +443,7 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) LOOP ENDIF - IF ParseProto( s, cWidget, @txt_, @doc_, enum_, func_ ) + IF ParseProto( s, cWidget, @txt_, @doc_, enum_, func_, lList ) nCnvrtd++ ELSE aadd( dummy_, cOrg ) @@ -530,63 +532,82 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) lDestructor := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "destructor" .AND. lower( e_[ 2 ] ) == "no" } ) == 0 lObject := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "qobject" .AND. lower( e_[ 2 ] ) == "no" } ) == 0 - IF ( lNewGCtoQT ) - lConst := .f. - FOR i := 3 TO len( new_ ) - 1 - IF left( ltrim( new_[ i ] ), 2 ) != "//" - IF "hb_retptr(" $ new_[ i ] - lConst := .t. - EXIT - ENDIF + lConst := .f. + FOR i := 3 TO len( new_ ) - 1 + IF left( ltrim( new_[ i ] ), 2 ) != "//" + IF "hb_retptr(" $ new_[ i ] + lConst := .t. + EXIT ENDIF - NEXT - - aadd( cpp_, "typedef struct" ) - aadd( cpp_, "{" ) - aadd( cpp_, " void * ph;" ) - aadd( cpp_, " bool bNew;" ) - aadd( cpp_, " QT_G_FUNC_PTR func;" ) - IF lObject - aadd( cpp_, " QPointer< "+ cWidget +" > pq;" ) ENDIF - aadd( cpp_, "} QGC_POINTER_" + cWidget + ";" ) - aadd( cpp_, " " ) + NEXT - aadd( cpp_, "QT_G_FUNC( hbqt_gcRelease_" + cWidget + " )" ) - aadd( cpp_, "{" ) - IF ( lDestructor ) .AND. ( lConst ) - IF lObject - aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) Cargo; " ) - aadd( cpp_, " " ) - aadd( cpp_, " if( p && p->bNew )" ) - aadd( cpp_, " {" ) - aadd( cpp_, " if( p->ph && p->pq )" ) - aadd( cpp_, " {" ) - aadd( cpp_, " const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject();" ) - aadd( cpp_, ' if( ( QString ) m->className() != ( QString ) "QObject" )' ) - aadd( cpp_, " {" ) - aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p YES_rel_' + cWidget + ' /.\\ pq=%p", p->ph, (void *)(p->pq) ) );') - aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph ); " ) - aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p YES_rel_' + cWidget + ' \\./ pq=%p", p->ph, (void *)(p->pq) ) );') - aadd( cpp_, " p->ph = NULL;" ) - aadd( cpp_, " }" ) - aadd( cpp_, " else" ) - aadd( cpp_, " {" ) - aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p NO__rel_' + cWidget + ' pq=%p", p->ph, (void *)(p->pq) ) );') - aadd( cpp_, " p->ph = NULL;" ) - aadd( cpp_, " }" ) - ELSE - aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) Cargo;" ) - aadd( cpp_, " " ) - aadd( cpp_, " if( p && p->bNew )" ) - aadd( cpp_, " {" ) - aadd( cpp_, " if( p->ph )" ) - aadd( cpp_, " {" ) - aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p _rel_' + cWidget + ' /.\\", p->ph ) );' ) - aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph ); " ) - aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p YES_rel_' + cWidget + ' \\./", p->ph ) );' ) - aadd( cpp_, " p->ph = NULL;" ) - ENDIF + aadd( cpp_, "typedef struct" ) + aadd( cpp_, "{" ) + IF lObject + aadd( cpp_, " QPointer< "+ cWidget +" > ph;" ) + ELSE + IF lList + aadd( cpp_, " " + cWidget + "< void * > * ph;" ) + ELSE + aadd( cpp_, " " + cWidget + " * ph;" ) + ENDIF + ENDIF + aadd( cpp_, " bool bNew;" ) + aadd( cpp_, " QT_G_FUNC_PTR func;" ) + aadd( cpp_, "} QGC_POINTER_" + cWidget + ";" ) + aadd( cpp_, " " ) + + aadd( cpp_, "QT_G_FUNC( hbqt_gcRelease_" + cWidget + " )" ) + aadd( cpp_, "{" ) + IF ( lDestructor ) .AND. ( lConst ) + IF lObject + aadd( cpp_, " " + cWidget + " " + iif( lList, "< void * >", "" )+" * ph = NULL ;" ) + aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) Cargo; " ) + aadd( cpp_, " " ) + aadd( cpp_, " if( p && p->bNew && p->ph )" ) + aadd( cpp_, " {" ) + aadd( cpp_, " ph = p->ph; " ) + aadd( cpp_, " if( ph )" ) + aadd( cpp_, " {" ) + aadd( cpp_, " const QMetaObject * m = ( ph )->metaObject();" ) + aadd( cpp_, ' if( ( QString ) m->className() != ( QString ) "QObject" )' ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p %p YES_rel_' + cWidget + ' /.\\ ", (void*) ph, (void*) p->ph ) );' ) + aadd( cpp_, " delete ( p->ph ); " ) + * aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p %p YES_rel_' + cWidget + ' ==== ", (void*) ph, (void*) p->ph ) );' ) + * aadd( cpp_, " delete ( ph ); " ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p %p YES_rel_' + cWidget + ' \\./ ", (void*) ph, (void*) p->ph ) );' ) + aadd( cpp_, " p->ph = NULL;" ) + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p NO__rel_' + cWidget + ' ", ph ) );') + aadd( cpp_, " p->ph = NULL;" ) + aadd( cpp_, " }" ) + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p DEL_rel_' + cWidget + ' : Object already deleted!", ph ) );' ) + aadd( cpp_, " p->ph = NULL;" ) + aadd( cpp_, " }" ) + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p PTR_rel_' + cWidget + ' : Object not created with new=true", ph ) );' ) + aadd( cpp_, " p->ph = NULL;" ) + aadd( cpp_, " }" ) + ELSE + aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) Cargo;" ) + aadd( cpp_, " " ) + aadd( cpp_, " if( p && p->bNew )" ) + aadd( cpp_, " {" ) + aadd( cpp_, " if( p->ph )" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p _rel_' + cWidget + ' /.\\", p->ph ) );' ) + aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph ); " ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p YES_rel_' + cWidget + ' \\./", p->ph ) );' ) + aadd( cpp_, " p->ph = NULL;" ) aadd( cpp_, " }" ) aadd( cpp_, " else" ) aadd( cpp_, " {" ) @@ -599,89 +620,79 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p PTR_rel_' + cWidget + ' : Object not created with new=true", p->ph ) );' ) aadd( cpp_, " p->ph = NULL;" ) aadd( cpp_, " }" ) - ELSE - aadd( cpp_, " HB_SYMBOL_UNUSED( Cargo );" ) - aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) Cargo;" ) - aadd( cpp_, " " ) - aadd( cpp_, " if( p && p->bNew )" ) - aadd( cpp_, " {" ) - aadd( cpp_, " p->ph = NULL;" ) - aadd( cpp_, " }" ) ENDIF - aadd( cpp_, "}" ) - aadd( cpp_, "" ) + ELSE + aadd( cpp_, " HB_SYMBOL_UNUSED( Cargo );" ) + aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) Cargo;" ) + aadd( cpp_, " " ) + aadd( cpp_, " if( p && p->bNew )" ) + aadd( cpp_, " {" ) + aadd( cpp_, " p->ph = NULL;" ) + aadd( cpp_, " }" ) ENDIF + aadd( cpp_, "}" ) + aadd( cpp_, "" ) - /* Insert CONSTRUCTOR - if defined */ - lConst := .f. - FOR i := 3 TO len( new_ ) - 1 - IF left( ltrim( new_[ i ] ), 2 ) != "//" - IF "hb_retptr(" $ new_[ i ] - lConst := .t. - EXIT - ENDIF - ENDIF - NEXT - IF ( lNewGCtoQT ) - aadd( cpp_, "void * hbqt_gcAllocate_" + cWidget + "( void * pObj, bool bNew )" ) - aadd( cpp_, "{ " ) - IF lObject - aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) hb_gcAllocate( sizeof( QGC_POINTER_" + cWidget + " ), hbqt_gcFuncs() );" ) - ELSE - aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() );" ) - ENDIF - aadd( cpp_, "" ) - aadd( cpp_, " p->ph = pObj;" ) - aadd( cpp_, " p->bNew = bNew;" ) - aadd( cpp_, " p->func = hbqt_gcRelease_" + cWidget + ";" ) - aadd( cpp_, "" ) - aadd( cpp_, " if( bNew )" ) - aadd( cpp_, " {" ) - IF lObject - aadd( cpp_, " new( & p->pq ) QPointer< "+ cWidget +" >( ( " + cWidget + " * ) pObj );" ) - ENDIF - aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p _new_' + cWidget + iif( lObject, ' under p->pq', '' ) + '", pObj ) );' ) - aadd( cpp_, " }" ) - aadd( cpp_, " else" ) - aadd( cpp_, " {" ) - aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p NOT_new_' + cWidget + '", pObj ) );' ) - aadd( cpp_, " }" ) - aadd( cpp_, " return p;" ) - aadd( cpp_, "}" ) - aadd( cpp_, "" ) + aadd( cpp_, "void * hbqt_gcAllocate_" + cWidget + "( void * pObj, bool bNew )" ) + aadd( cpp_, "{ " ) + IF lObject + aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) hb_gcAllocate( sizeof( QGC_POINTER_" + cWidget + " ), hbqt_gcFuncs() );" ) + ELSE + aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() );" ) + ENDIF + aadd( cpp_, "" ) + IF lObject + aadd( cpp_, " new( & p->ph ) QPointer< "+ cWidget +" >( ( " + cWidget + " * ) pObj );" ) + ELSE + aadd( cpp_, " p->ph = ( " + cWidget + iif( lList, "< void * >", "" ) + " * ) pObj;" ) + ENDIF + aadd( cpp_, " p->bNew = bNew;" ) + aadd( cpp_, " p->func = hbqt_gcRelease_" + cWidget + ";" ) + aadd( cpp_, "" ) + aadd( cpp_, " if( bNew )" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p _new_' + cWidget + iif( lObject, ' under p->pq', '' ) + '", pObj ) );' ) + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( ' + s_trMode + ', ( "ph=%p NOT_new_' + cWidget + '", pObj ) );' ) + aadd( cpp_, " }" ) + aadd( cpp_, " return p;" ) + aadd( cpp_, "}" ) + aadd( cpp_, "" ) - aadd( cpp_, new_[ 1 ] ) // Func definition - aadd( cpp_, new_[ 2 ] ) // { - IF lConst - - aadd( cpp_, " void * pObj = NULL;" ) - - aadd( cpp_, " " ) - FOR i := 3 TO len( new_ ) - 1 - IF left( ltrim( new_[ i ] ), 2 ) != "//" - IF "hb_retptr(" $ new_[ i ] - s := trim( strtran( new_[ i ], "hb_retptr(", "pObj =" ) ) - s := strtran( s, ");", ";" ) - aadd( cpp_, s ) - ELSE - aadd( cpp_, new_[ i ] ) - ENDIF + aadd( cpp_, new_[ 1 ] ) // Func definition + aadd( cpp_, new_[ 2 ] ) // { + IF lConst + if ( lList ) + aadd( cpp_, " " + cWidget + "< void * > * pObj = NULL;" ) + else + aadd( cpp_, " " + cWidget + " * pObj = NULL;" ) + endif + aadd( cpp_, " " ) + FOR i := 3 TO len( new_ ) - 1 + IF left( ltrim( new_[ i ] ), 2 ) != "//" + IF "hb_retptr(" $ new_[ i ] + s := new_[ i ] + s := trim( strtran( s, "hb_retptr(", "pObj =" ) ) + s := strtran( s, ");", ";" ) + s := strtran( s, "( "+ cWidget + "* )", "" ) + aadd( cpp_, s ) + ELSE + aadd( cpp_, new_[ i ] ) ENDIF - NEXT - aadd( cpp_, " " ) - aadd( cpp_, " hb_retptrGC( hbqt_gcAllocate_" + cWidget + "( pObj, true ) );" ) - #if 0 - IF lDestructor - aadd( cpp_, " hb_retptrGC( hbqt_gcAllocate_" + cWidget + "( pObj, true ) );" ) - ELSE - aadd( cpp_, " hb_retptr( pObj );" ) ENDIF - #endif - ENDIF - aadd( cpp_, new_[ len( new_ ) ] ) // } - aadd( cpp_, "" ) + NEXT + aadd( cpp_, " " ) + aadd( cpp_, " hb_retptrGC( hbqt_gcAllocate_" + cWidget + "( ( void * ) pObj, true ) );" ) + ELSE + FOR i := 3 TO len( new_ ) - 1 + aadd( cpp_, new_[ i ] ) + NEXT ENDIF + aadd( cpp_, new_[ len( new_ ) ] ) // } + aadd( cpp_, "" ) /* Insert Functions */ aeval( txt_, {|e| aadd( cpp_, strtran( e, chr( 13 ), '' ) ) } ) @@ -751,12 +762,11 @@ FUNCTION GetSourcePathByLib( cWidget, cPathOut, cExt, cPre ) #define THIS_PROPER( s ) ( upper( left( s,1 ) ) + substr( s,2 ) ) -STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) +STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_, lList ) LOCAL aRet, aA, aArgus, aArg, aPar, aPre, n, nn, nHBIdx LOCAL cPre, cPar, cRet, cFun, cParas, cDocs, cCmd, cPas, s, ss, cFirstParamCast LOCAL cWdg, cCmn, cPrgRet, cHBFunc, cHBIdx, cDocNM - LOCAL lSuccess - * LOCAL cInt := 'int,qint16,quint16,QChar,short,ushort' + LOCAL lSuccess, FP LOCAL cInt := 'int,qint16,quint16,short,ushort' LOCAL cIntLong := 'qint32,quint32,QRgb' LOCAL cIntLongLong := 'qint64,quint64,qlonglong,qulonglong' @@ -1197,9 +1207,9 @@ STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) aadd( txt_, "/*" ) aadd( txt_, " * " + strtran( cProto, chr(13), '' ) ) aadd( txt_, " */" ) - aadd( txt_, "HB_FUNC( QT_" + upper( cWidget ) + "_" + upper( cHBFunc ) + " )" ) aadd( txt_, "{" ) + aadd( txt_, " " + cWidget + iif( lList, "< void *>", "" ) + " * p = hbqt_par_" + cWidget + "( 1 );" ) /* Insert parameters by reference */ IF ! empty( aPre ) @@ -1210,7 +1220,13 @@ STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) ENDIF /* One line function body */ - aadd( txt_, " "+ cCmd ) + FP = strtran( cCmd, "hbqt_par_" + cWidget + "( 1 )", "( p )" ) + aadd( txt_, " if( p )" ) + aadd( txt_, " " + FP ) + aadd( txt_, " else" ) + aadd( txt_, " {" ) + aadd( txt_, ' HB_TRACE( ' + s_trMode + ', ( "............................... F=QT_' + upper( cWidget ) + '_' + upper( cHBFunc) + ' FP=' + FP + ' p is NULL" ) );') + aadd( txt_, " }" ) /* Return values back to PRG */ IF ! empty( aPre ) diff --git a/harbour/contrib/hbqt/hbqt_hbslots.cpp b/harbour/contrib/hbqt/hbqt_hbslots.cpp index b72460ce9d..4b0dbb55e0 100644 --- a/harbour/contrib/hbqt/hbqt_hbslots.cpp +++ b/harbour/contrib/hbqt/hbqt_hbslots.cpp @@ -752,6 +752,7 @@ HBSlots::~HBSlots() { if( listBlock[ i ] != NULL ) { +HB_TRACE( HB_TR_ALWAYS, ( "......HBSlots::~HBSlots()...... [ Un-disConnected Slot ]" ) ); hb_itemRelease( listBlock.at( i ) ); listBlock[ i ] = NULL; } @@ -1036,6 +1037,7 @@ HB_FUNC( QT_SLOTS_CONNECT ) if( t_slots ) { +HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_CONNECT( %s )", hb_parcx( 3 ) ) ); QObject * object = ( QObject * ) hbqt_pPtrFromObj( 2 ); /* get sender */ if( object ) { @@ -1052,6 +1054,7 @@ HB_FUNC( QT_SLOTS_CONNECT ) bRet = HB_TRUE; } } +HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_CONNECT( %s ) %s", hb_parcx( 3 ), bRet ? "Connected" : "not-connected" ) ); } } hb_retl( bRet ); @@ -1067,6 +1070,7 @@ HB_FUNC( QT_SLOTS_DISCONNECT ) if( t_slots ) { +HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_DISCONNECT( %s )", hb_parcx( 3 ) ) ); QObject * object = ( QObject* ) hbqt_pPtrFromObj( 2 ); if( object ) { @@ -1085,6 +1089,7 @@ HB_FUNC( QT_SLOTS_DISCONNECT ) HB_TRACE( HB_TR_DEBUG, ( " QT_SLOTS_DISCONNECT: %s %s", bRet ? "YES" : "NO", slot ) ); } +HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_DISCONNECT( %s ) %s", hb_parcx( 3 ), bRet ? "disConnected" : "not-disConnected" ) ); } } hb_retl( bRet ); diff --git a/harbour/contrib/hbqt/qth/QApplication.qth b/harbour/contrib/hbqt/qth/QApplication.qth index 613f1ccfdc..2c377944ec 100644 --- a/harbour/contrib/hbqt/qth/QApplication.qth +++ b/harbour/contrib/hbqt/qth/QApplication.qth @@ -97,15 +97,16 @@ HB_FUNC( HB_QT ) {;} HB_FUNC( QT_QAPPLICATION ) { - hb_retptr( ( QApplication * ) s_app ); + //hb_retptr( ( QApplication * ) s_app ); + hb_retptr ( s_app ); } static void hbqt_Exit( void * cargo ) { HB_SYMBOL_UNUSED( cargo ); - s_app->quit(); - s_app = NULL; + //s_app->quit(); + //s_app = NULL; } static void hbqt_Init( void * cargo ) diff --git a/harbour/contrib/hbqt/qth/QLayout.qth b/harbour/contrib/hbqt/qth/QLayout.qth index dfcb1d52b2..c2ca42b6d5 100644 --- a/harbour/contrib/hbqt/qth/QLayout.qth +++ b/harbour/contrib/hbqt/qth/QLayout.qth @@ -71,6 +71,30 @@ HB_FUNC( QT_QLAYOUT ) { } + +/* + * virtual void addItem ( QLayoutItem * item ) = 0 + */ +/* +HB_FUNC( QT_QLAYOUT_ADDITEM ) +{ + QGC_POINTER * p; + QGC_POINTER * q; + + HB_TRACE( HB_TR_DEBUG, ( "Entering function QT_QLAYOUT_ADDITEM()" ) ); + + q = ( QGC_POINTER * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); + p = ( QGC_POINTER * ) hb_parptrGC( hbqt_gcFuncs(), 2 ); + + if( p && p->ph && q && q->ph ) + { + HB_TRACE( HB_TR_DEBUG, ( "QT_QLAYOUT_ADDITEM() Qt oject: %p is attached to: %p", p->ph, q->ph ) ); + p->bNew = HB_FALSE; + } + + hbqt_par_QLayout( 1 )->addItem( hbqt_par_QLayoutItem( 2 ) ); +} +*/ diff --git a/harbour/contrib/hbxbp/hbpprocess.prg b/harbour/contrib/hbxbp/hbpprocess.prg index 8ae94c6347..4dc927fdf7 100644 --- a/harbour/contrib/hbxbp/hbpprocess.prg +++ b/harbour/contrib/hbxbp/hbpprocess.prg @@ -245,7 +245,7 @@ METHOD HbpProcess:read( nMode, i, ii ) DO CASE CASE nMode == CHN_BGN ::outputMe( "CurDir() => " + CurDir() + " Starting in => " + ::qProcess:workingDirectory() ) - + CASE nMode == CHN_OUT ::qProcess:setReadChannel( 0 ) cLine := space( nSize ) @@ -301,8 +301,8 @@ METHOD HbpProcess:finish() ::qProcess:kill() // - ::qProcess:pPtr := NIL ::qProcess := NIL + ::qStrList := NIL RETURN Self diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index 2fc07037b7..588bd5879a 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -78,7 +78,6 @@ /*----------------------------------------------------------------------*/ STATIC s_oDeskTop -STATIC s_oApp STATIC s_hLastEvent := {=>} THREAD STATIC t_events @@ -101,8 +100,6 @@ INIT PROCEDURE hbxbp_Start() hbqt_errorsys() - s_oApp := QApplication():new() - RETURN /*----------------------------------------------------------------------*/ @@ -113,12 +110,11 @@ EXIT PROCEDURE hbxbp_End() t_oAppWindow := NIL IF hb_isObject( s_oDeskTop ) - s_oDeskTop:oWidget:pPtr := NIL - endif + s_oDeskTop:oWidget := NIL + ENDIF - /* These must never be called from here as QApplication.cpp's EXIT routine does it */ - //s_oApp:quit() - //s_oApp := NIL + t_qtEvents := NIL + t_qtSlots := NIL HB_TRACE( HB_TR_ALWAYS, "................................... EXIT PROCEDURE hbxbp_End() end " ) RETURN @@ -191,7 +187,8 @@ FUNCTION PostAppEvent( nEvent, mp1, mp2, oXbp ) IF nEvent == xbeP_Keyboard IF mp1 == xbeK_TAB qEvent := QEvent():new( QEvent_KeyPress ) - s_oApp:postEvent( oXbp:oWidget, qEvent ) + //s_oApp:postEvent( oXbp:oWidget, qEvent ) + QApplication():new():postEvent( oXbp:oWidget, qEvent ) ENDIF ENDIF diff --git a/harbour/contrib/hbxbp/xbprtf.prg b/harbour/contrib/hbxbp/xbprtf.prg index eb9dcd75d0..3a55c61cef 100644 --- a/harbour/contrib/hbxbp/xbprtf.prg +++ b/harbour/contrib/hbxbp/xbprtf.prg @@ -243,6 +243,10 @@ METHOD XbpRtf:destroy() ::xbpWindow:destroy() + ::oTextDocument := NIL + ::oTextCursor := NIL + ::oTextCharFormat := NIL + RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbxbp/xbpstatic.prg b/harbour/contrib/hbxbp/xbpstatic.prg index 5281763dcd..8fdff56f7f 100644 --- a/harbour/contrib/hbxbp/xbpstatic.prg +++ b/harbour/contrib/hbxbp/xbpstatic.prg @@ -364,7 +364,7 @@ METHOD XbpStatic:setCaption( xCaption, cDll ) IF ::options == XBPSTATIC_BITMAP_SCALED ::oWidget:setScaledContents( .t. ) ENDIF - ::oWidget:setPixmap( QPixmap():fromImage( ::caption:oWidget ) ) + ::oWidget:setPixmap( QPixmap():new():fromImage( ::caption:oWidget ) ) ELSEIF hb_isChar( ::caption ) /* $HARBOUR$ */ IF ::options == XBPSTATIC_BITMAP_SCALED @@ -381,7 +381,7 @@ METHOD XbpStatic:setCaption( xCaption, cDll ) oPixmap := QPixmap() oIcon := QIcon() oStyle := QStyle() - oStyle:pPtr := QApplication():style() + oStyle:pPtr := QApplication():new():style() DO CASE CASE ::caption == XBPSTATIC_SYSICON_ICONINFORMATION