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.
This commit is contained in:
Pritpal Bedi
2010-01-29 02:07:36 +00:00
parent acbbde9abe
commit 3b97f4737c
11 changed files with 85 additions and 96 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,7 @@
* Harbour Project source code:
* Source file for the Xbp*Classes
*
* Copyright 2008 Pritpal Bedi <pritpal@vouchcac.com>
* Copyright 2010 Pritpal Bedi <pritpal@vouchcac.com>
* 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 <pritpal@vouchcac.com>
* 18Decy2009
* Pritpal Bedi <pritpal@vouchcac.com>
* 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

View File

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

View File

@@ -10,7 +10,6 @@ LIBNAME := hbxbp
PRG_SOURCES := \
hbpprocess.prg \
hbpqtui.prg \
xbp3state.prg \
xbpappevent.prg \
xbpbitmap.prg \

View File

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

View File

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