diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 94092740b3..c41e2ef503 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-28 18:03 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/filelist.mk + + contrib/hbqt/THbpQtUI.prg + + - contrib/hbxbp/hbpqtui.prg + * contrib/hbxbp/Makefile + * contrib/hbxbp/xbpdialog.prg + * contrib/hbxbp/xbpwindow.prg + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/idefindreplace.prg + * contrib/hbide/ideprojmanager.prg + * contrib/hbide/idethemes.prg + + -+ Shifted HbpQtUI() class from hbXBP to hbQT. + 2010-01-29 00:34 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg % Re-merged Harbour and xhb section in .c stub. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index f75e91d494..95b05c43d3 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -546,7 +546,7 @@ METHOD HbIde:execEditorAction( cKey ) ENDIF EXIT CASE "Search" - IdeFindInFiles():new( Self ):create():show() + IdeFindInFiles():new( Self ):create() EXIT CASE "SetMark" ::oEM:setMark() diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index eb89dd3ab9..df1d6d5ee3 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -127,15 +127,10 @@ METHOD IdeDocks:destroy() METHOD IdeDocks:buildDialog() #if 1 - LOCAL oUI - oUI := HbpQtUI():new() - oUI:file := ::resPath + "mainWindow.ui" - oUI:create() - ::oIde:oDlg := XbpDialog():new() ::oDlg:icon := ::resPath + "vr.png" // "hbide.png" ::oDlg:title := "Harbour-Qt IDE" - ::oDlg:qtObject := oUI:oWidget + ::oDlg:qtObject := HbpQtUI():new( ::resPath + "mainWindow.ui" ) ::oDlg:create( , , , , , .f. ) #else ::oIde:oDlg := XbpDialog():new( , , {10,10}, {1100,700}, , .f. ) diff --git a/harbour/contrib/hbide/idefindreplace.prg b/harbour/contrib/hbide/idefindreplace.prg index ee24227be2..8d515b5645 100644 --- a/harbour/contrib/hbide/idefindreplace.prg +++ b/harbour/contrib/hbide/idefindreplace.prg @@ -96,15 +96,21 @@ METHOD IdeFindReplace:new( oIde ) /*----------------------------------------------------------------------*/ +METHOD IdeFindReplace:destroy() + + ::oUI:destroy() + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeFindReplace:create( oIde ) DEFAULT oIde TO ::oIde ::oIde := oIde - ::oUI := HbpQtUI():new( ::oIde:oDlg ) - ::oUI:file := ::oIde:resPath + "finddialog.ui" - ::oUI:create() + ::oUI := HbpQtUI():new( ::oIde:resPath + "finddialog.ui", ::oIde:oDlg:oWidget ) ::oUI:setWindowFlags( Qt_Sheet ) aeval( ::oIde:aIni[ INI_FIND ], {|e| ::oUI:q_comboFindWhat:addItem( e ) } ) @@ -128,16 +134,6 @@ METHOD IdeFindReplace:create( oIde ) /*----------------------------------------------------------------------*/ -METHOD IdeFindReplace:destroy() - - ::oUI:hide() - ::oUI:destroy() - ::oUI:oWidget:pPtr := 0 - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeFindReplace:show() LOCAL cText, qLineEdit @@ -336,10 +332,8 @@ METHOD IdeFindInFiles:create( oIde ) ::oIde := oIde - ::oUI := HbpQtUI():new( ::oIde:oDlg ) - ::oUI:file := ::oIde:resPath + "findinfiles.ui" - ::oUI:create() - //::oUI:setWindowFlags( Qt_Sheet ) + ::oUI := HbpQtUI():new( ::oIde:resPath + "findinfiles.ui", ::oIde:oDlg:oWidget ) + ::oUI:setWindowFlags( Qt_Sheet ) ::oUI:exec() ::destroy() @@ -350,13 +344,8 @@ METHOD IdeFindInFiles:create( oIde ) METHOD IdeFindInFiles:destroy() - ::oUI:hide() - ::oUI:destroy() - ::oUI:oWidget:pPtr := 0 - ::oUI:oWidget:pPtr := NIL - RETURN Self /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index 5eda008c7f..3aa0bb9b99 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -544,9 +544,7 @@ METHOD IdeProjManager:fetchProperties() LOCAL cLukupPng LOCAL cPrjLoc := hb_dirBase() + "projects" - ::oUI := HbpQtUI():new( ::oDlg ) - ::oUI:file := ::resPath + "projectproperties.ui" - ::oUI:create() + ::oUI := HbpQtUI():new( ::resPath + "projectproperties.ui", ::oDlg:oWidget ) ::oUI:q_tabWidget:removeTab( 4 ) @@ -955,9 +953,7 @@ METHOD IdeProjManager:loadXhpProject() METHOD IdeProjManager:manageEnvironments() LOCAL cLukupPng - ::oUI := HbpQtUI():new( ::oDlg ) - ::oUI:file := ::resPath + "projectproperties.ui" - ::oUI:create() + ::oUI := HbpQtUI():new( ::resPath + "projectproperties.ui", ::oDlg:oWidget ) cLukupPng := ::resPath + "folder.png" // @@ -1259,9 +1255,7 @@ METHOD IdeProjManager:selectCurrentProject() RETURN ::cWrkProject ENDIF - oDlg := HbpQtUI():new( ::oDlg ) - oDlg:file := ::oIDE:resPath + "selectproject.ui" - oDlg:create() + oDlg := HbpQtUI():new( ::oIDE:resPath + "selectproject.ui", ::oDlg:oWidget ) * Fill ComboBox with current project names FOR i := 1 TO Len( ::aProjects ) diff --git a/harbour/contrib/hbide/idethemes.prg b/harbour/contrib/hbide/idethemes.prg index 8a6e92425b..952aa1d126 100644 --- a/harbour/contrib/hbide/idethemes.prg +++ b/harbour/contrib/hbide/idethemes.prg @@ -411,9 +411,7 @@ METHOD IdeThemes:fetch() IF empty( ::oUI ) ::lCreating := .t. - ::oUI := HbpQtUI():new( ::oIde:oDlg ) - ::oUI:file := ::oIde:resPath + "themes.ui" - ::oUI:create() + ::oUI := HbpQtUI():new( ::oIde:resPath + "themes.ui", ::oIde:oDlg:oWidget ) ::oUI:setWindowFlags( Qt_Sheet ) ::oUI:signal( "comboThemes" , "currentIndexChanged(int)", {|o,i| ::nCurTheme := i+1, ::setTheme( i,o ) } ) @@ -588,9 +586,7 @@ METHOD IdeThemes:selectTheme() LOCAL oSL, oStrList, oStrModel, a_, nDone LOCAL pSlots := Qt_Slots_New() - oSL := HbpQtUI():new( ::oIde:oDlg ) - oSL:file := ::oIde:resPath + "selectionlist.ui" - oSL:create() + oSL := HbpQtUI():new( ::oIde:resPath + "selectionlist.ui", ::oIde:oDlg:oWidget ) oSL:setWindowTitle( "Available Themes" ) oStrList := QStringList():new() diff --git a/harbour/contrib/hbxbp/hbpqtui.prg b/harbour/contrib/hbqt/THbpQtUI.prg similarity index 79% rename from harbour/contrib/hbxbp/hbpqtui.prg rename to harbour/contrib/hbqt/THbpQtUI.prg index c66778f16a..bc4986c0c0 100644 --- a/harbour/contrib/hbxbp/hbpqtui.prg +++ b/harbour/contrib/hbqt/THbpQtUI.prg @@ -6,7 +6,7 @@ * Harbour Project source code: * Source file for the Xbp*Classes * - * Copyright 2008 Pritpal Bedi + * Copyright 2010 Pritpal Bedi * http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -56,10 +56,10 @@ * EkOnkar * ( The LORD is ONE ) * - * Xbase++ Syntax Inspired HbpQtUI Class + * Harbour Parts HbpQtUI Class * - * Pritpal Bedi - * 18Decy2009 + * Pritpal Bedi + * 28Jan2010 */ /*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/ @@ -67,33 +67,27 @@ #include "hbclass.ch" #include "common.ch" -#include "inkey.ch" - -#include "xbp.ch" -#include "appevent.ch" /*----------------------------------------------------------------------*/ -CLASS HbpQtUI INHERIT XbpWindow +CLASS HbpQtUI - DATA file INIT "" - DATA modal INIT .t. + DATA pSlots + DATA oWidget DATA qObj INIT hb_hash() DATA widgets INIT {} DATA aSignals INIT {} DATA aEvents INIT {} - METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) VIRTUAL + METHOD new( cFile, qParent ) METHOD destroy() METHOD event( cWidget, nEvent, bBlock ) METHOD signal( cWidget, cSignal, bBlock ) METHOD loadWidgets() METHOD loadContents( cUiFull ) - METHOD loadUI( cUiFull ) + METHOD loadUI( cUiFull, qParent ) ERROR HANDLER OnError( ... ) @@ -101,29 +95,18 @@ CLASS HbpQtUI INHERIT XbpWindow /*----------------------------------------------------------------------*/ -METHOD HbpQtUI:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) +METHOD HbpQtUI:new( cFile, qParent ) - ::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD HbpQtUI:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - - ::xbpWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - - IF !empty( ::file ) .and. file( ::file ) + IF !empty( cFile ) .and. file( cFile ) hb_hCaseMatch( ::qObj, .f. ) - ::loadContents( ::file ) + ::loadContents( cFile, qParent ) - ::oWidget := ::loadUI( ::file ) + ::oWidget := ::loadUI( cFile, qParent ) IF !empty( ::oWidget ) ::loadWidgets() ENDIF - ENDIF RETURN Self @@ -131,18 +114,28 @@ METHOD HbpQtUI:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) /*----------------------------------------------------------------------*/ METHOD HbpQtUI:destroy() - LOCAL a_ + LOCAL a_, qObj + + ::oWidget:hide() FOR EACH a_ IN ::aSignals Qt_Slots_disConnect( ::pSlots, a_[ 1 ], a_[ 2 ] ) NEXT - FOR EACH a_ IN ::aEvents Qt_Events_disConnect( ::pEvents, a_[ 1 ], a_[ 2 ] ) NEXT - ::oWidget:hide() + FOR EACH qObj IN ::qObj + qObj:pPtr := 0 + qObj:pPtr := NIL + NEXT + + ::oWidget:close() + ::oWidget:pPtr := 0 + ::oWidget := NIL + ::aEvents := NIL + ::aSignals := NIL RETURN NIL @@ -163,6 +156,9 @@ METHOD HbpQtUI:event( cWidget, nEvent, bBlock ) METHOD HbpQtUI:signal( cWidget, cSignal, bBlock ) IF hb_hHasKey( ::qObj, cWidget ) + IF empty( ::pSlots ) + ::pSlots := QT_SLOTS_NEW() + ENDIF IF Qt_Slots_Connect( ::pSlots, ::qObj[ cWidget ], cSignal, bBlock ) aadd( ::aSignals, { ::qObj[ cWidget ], cSignal } ) ENDIF @@ -214,8 +210,6 @@ METHOD HbpQtUI:loadContents( cUiFull ) cWidget := alltrim( strtran( substr( cBuffer, 1, n-1 ), '"', "" ) ) cWidget := strtran( cWidget, "/", "" ) - HBXBP_DEBUG( pad( cClass,30 ), cWidget ) - aadd( ::widgets, { cClass, cWidget } ) ENDDO @@ -223,41 +217,40 @@ METHOD HbpQtUI:loadContents( cUiFull ) /*----------------------------------------------------------------------*/ -METHOD HbpQtUI:loadUI( cUiFull ) - LOCAL qWidget, qUiLoader, qFile, pWidget +METHOD HbpQtUI:loadUI( cUiFull, qParent ) + LOCAL oWidget, qUiLoader, qFile, pWidget qFile := QFile():new( cUiFull ) IF qFile:open( 1 ) qUiLoader := QUiLoader():new() - pWidget := qUiLoader:load( qFile, IF( empty( ::oParent ), NIL, ::oParent:oWidget ) ) + pWidget := qUiLoader:load( qFile, qParent ) DO CASE CASE ::widgets[ 1,1 ] == "QWidget" - qWidget := QWidget():configure( pWidget ) + oWidget := QWidget():configure( pWidget ) CASE ::widgets[ 1,1 ] == "QDialog" - qWidget := QDialog():configure( pWidget ) + oWidget := QDialog():configure( pWidget ) CASE ::widgets[ 1,1 ] == "QMainWindow" - qWidget := QMainWindow():configure( pWidget ) + oWidget := QMainWindow():configure( pWidget ) OTHERWISE - qWidget := QWidget():configure( pWidget ) + oWidget := QWidget():configure( pWidget ) ENDCASE qFile:close() + qFile:pPtr := NIL + qUiLoader:pPtr := NIL ENDIF - RETURN qWidget + RETURN oWidget /*----------------------------------------------------------------------*/ METHOD HbpQtUI:OnError( ... ) - LOCAL cMsg - LOCAL xReturn + LOCAL cMsg, xReturn cMsg := __GetMessage() IF SubStr( cMsg, 1, 1 ) == "_" cMsg := SubStr( cMsg, 2 ) ENDIF - HBXBP_DEBUG( "OnError", cMsg ) - IF left( cMsg, 2 ) == "Q_" xReturn := ::qObj[ substr( cMsg, 3 ) ] ELSE diff --git a/harbour/contrib/hbqt/filelist.mk b/harbour/contrib/hbqt/filelist.mk index 4c6e810969..62c89fa3aa 100644 --- a/harbour/contrib/hbqt/filelist.mk +++ b/harbour/contrib/hbqt/filelist.mk @@ -26,6 +26,7 @@ CPP_SOURCES := \ PRG_SOURCES := \ hbqt_misc.prg \ hbqt_errorsys.prg \ - + THbpQtUI.prg \ + # Don't delete this comment, it's here to ensure empty # line above is kept intact. diff --git a/harbour/contrib/hbxbp/Makefile b/harbour/contrib/hbxbp/Makefile index 304057b9a4..dab73dae24 100644 --- a/harbour/contrib/hbxbp/Makefile +++ b/harbour/contrib/hbxbp/Makefile @@ -10,7 +10,6 @@ LIBNAME := hbxbp PRG_SOURCES := \ hbpprocess.prg \ - hbpqtui.prg \ xbp3state.prg \ xbpappevent.prg \ xbpbitmap.prg \ diff --git a/harbour/contrib/hbxbp/xbpdialog.prg b/harbour/contrib/hbxbp/xbpdialog.prg index 34f9e28748..3667145e29 100644 --- a/harbour/contrib/hbxbp/xbpdialog.prg +++ b/harbour/contrib/hbxbp/xbpdialog.prg @@ -139,6 +139,7 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) IF !empty( ::qtObject ) IF hb_isObject( ::qtObject ) ::oWidget := ::qtObject + ::qtObject := NIL ELSE ::oWidget := QMainWindow() ::oWidget:pPtr := hbqt_ptr( ::qtObject ) diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index a367bd1e64..a7818c071b 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -460,8 +460,8 @@ METHOD XbpWindow:destroy() LOCAL e_ LOCAL cXbp := __ObjGetClsName( self ) -//HBXBP_DEBUG( ". " ) -//HBXBP_DEBUG( hb_threadId(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) +//HBXBP_DBG( ". " ) +//HBXBP_DBG( hb_threadId(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) IF cXbp == "XBPDIALOG" hbxbp_SetEventLoop( NIL ) @@ -489,10 +489,14 @@ METHOD XbpWindow:destroy() ::XbpPartHandler:destroy() ::clearSlots() + IF !empty( ::qtObject ) + ::qtObject:destroy() + ::qtObject := NIL + ENDIF ::oWidget:pPtr := 0 ::oWidget := NIL -//HBXBP_DEBUG( hb_threadId()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) +//HBXBP_DBG( hb_threadId()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) RETURN NIL