2012-03-06 16:47 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/hbide.hbp
* contrib/hbide/ideactions.prg
* contrib/hbide/idedocks.prg
* contrib/hbide/ideenviron.prg
* contrib/hbide/idemain.prg
* contrib/hbide/ideobject.prg
+ contrib/hbide/ideuisrcmanager.prg
+ Started: implementation of IDE's next evolution step to
write the upper level code to manipulate Qt Designer
generated ".ui" dialogs.
HOW IT WORKS
1. Click on "UI Source Manager" icon or "View" menu option.
Will open a dock widget at the right docking area.
2. Drop a .ui ( take one from hbide included .ui's ) onto it.
The dialog will show up.
3. Click on "Build Source" icon on top-toolbar of "UI Src Manager"
dock widget. Notice that a new editing instance is initiated
on the current panel with source file prefixed with "cls_"
and suffixed by .ui's filename. For example, if you have
dropped "dbstruct.ui" then source will be "cls_dbstruct.prg".
This .prg will reside in the same folder where .ui is.
4. Examine the class code contained in the .prg.
5. Click on various controls and see a focus rectangle is placed
around that control. Also viaualize the status-bar.
6. If the control happens to be of type QToolButton or QPushButton
( proof of concept is build for these controls only, yet ),
you will see two entries in lower-left tree view.
7. Click on "Activated" tree-node and see the right-side editor
comes into focus. Write some code in this editor, and then
click on some other control or other tree-node.
8. Visualize that editing instance containing "cls_*ui.prg" will
be refreshed and will contain some additional methods.
9. Now change something in the source itself, save, and come out,
then re-drop the same .ui. See that changes will be reflected
in methods represented in the tree-nodes.
PLAY AROUND. Concept is in the making and have to go a long way,
but surely it has a potentiality to reach a mile-stone.
Your suggestions are welcome.
This commit is contained in:
@@ -16,6 +16,48 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-03-06 16:47 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbide/hbide.hbp
|
||||
* contrib/hbide/ideactions.prg
|
||||
* contrib/hbide/idedocks.prg
|
||||
* contrib/hbide/ideenviron.prg
|
||||
* contrib/hbide/idemain.prg
|
||||
* contrib/hbide/ideobject.prg
|
||||
+ contrib/hbide/ideuisrcmanager.prg
|
||||
+ Started: implementation of IDE's next evolution step to
|
||||
write the upper level code to manipulate Qt Designer
|
||||
generated ".ui" dialogs.
|
||||
HOW IT WORKS
|
||||
|
||||
1. Click on "UI Source Manager" icon or "View" menu option.
|
||||
Will open a dock widget at the right docking area.
|
||||
2. Drop a .ui ( take one from hbide included .ui's ) onto it.
|
||||
The dialog will show up.
|
||||
3. Click on "Build Source" icon on top-toolbar of "UI Src Manager"
|
||||
dock widget. Notice that a new editing instance is initiated
|
||||
on the current panel with source file prefixed with "cls_"
|
||||
and suffixed by .ui's filename. For example, if you have
|
||||
dropped "dbstruct.ui" then source will be "cls_dbstruct.prg".
|
||||
This .prg will reside in the same folder where .ui is.
|
||||
4. Examine the class code contained in the .prg.
|
||||
5. Click on various controls and see a focus rectangle is placed
|
||||
around that control. Also viaualize the status-bar.
|
||||
6. If the control happens to be of type QToolButton or QPushButton
|
||||
( proof of concept is build for these controls only, yet ),
|
||||
you will see two entries in lower-left tree view.
|
||||
7. Click on "Activated" tree-node and see the right-side editor
|
||||
comes into focus. Write some code in this editor, and then
|
||||
click on some other control or other tree-node.
|
||||
8. Visualize that editing instance containing "cls_*ui.prg" will
|
||||
be refreshed and will contain some additional methods.
|
||||
9. Now change something in the source itself, save, and come out,
|
||||
then re-drop the same .ui. See that changes will be reflected
|
||||
in methods represented in the tree-nodes.
|
||||
|
||||
PLAY AROUND. Concept is in the making and have to go a long way,
|
||||
but surely it has a potentiality to reach a mile-stone.
|
||||
Your suggestions are welcome.
|
||||
|
||||
2012-03-04 23:11 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
+ package/harbour.rb
|
||||
+ experimental (and untested) Homebrew formula
|
||||
|
||||
@@ -57,6 +57,7 @@ ideformat.prg
|
||||
idechangelog.prg
|
||||
ideconsole.prg
|
||||
ideparseexpr.c
|
||||
ideuisrcmanager.prg
|
||||
|
||||
docviewgenerator.ui
|
||||
docwriter.ui
|
||||
|
||||
@@ -273,6 +273,7 @@ METHOD IdeActions:loadActions()
|
||||
aadd( aAct, { "LaunchProject" , "Launch Project" , "" , "^F10" , "No", "Yes" } )
|
||||
aadd( aAct, { "ConfigureTools" , "Configure Tools...*" , "" , "" , "No", "Yes" } )
|
||||
aadd( aAct, { "CuiEditor" , "CUI Screen Edirot" , "cuied" , "" , "No", "Yes" } )
|
||||
aadd( aAct, { "UISrcManager" , "UI Source Manager" , "fileprg" , "" , "No", "Yes" } )
|
||||
|
||||
aadd( aAct, { "ManageThemes" , "Manage Themes" , "" , "" , "No", "Yes" } )
|
||||
aadd( aAct, { "DefaultTheme" , "Set Default Theme" , "" , "" , "No", "Yes" } )
|
||||
@@ -558,6 +559,7 @@ METHOD IdeActions:buildMainMenu()
|
||||
oSubMenu:oWidget:addAction( ::oDK:qMdiToolbar:oWidget:toggleViewAction() )
|
||||
|
||||
oSubMenu:oWidget:addAction( ::oCuiEdDock:toggleViewAction() )
|
||||
oSubMenu:oWidget:addAction( ::oIde:oUISrcDock:toggleViewAction() )
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Project */
|
||||
|
||||
@@ -158,6 +158,7 @@ CLASS IdeDocks INHERIT IdeObject
|
||||
METHOD hideAllDocks()
|
||||
METHOD setToolbarSize( nSize )
|
||||
METHOD buildCuiEdWidget()
|
||||
METHOD buildUISrcDock()
|
||||
|
||||
ENDCLASS
|
||||
|
||||
@@ -200,6 +201,7 @@ METHOD IdeDocks:hideAllDocks()
|
||||
::oReportsManagerDock : hide()
|
||||
::oFormatDock : hide()
|
||||
::oCuiEdDock : hide()
|
||||
::oUiSrcDock : hide()
|
||||
|
||||
// Bottom
|
||||
::oDockB2 : hide()
|
||||
@@ -242,6 +244,7 @@ METHOD IdeDocks:destroy()
|
||||
::oReportsManagerDock:oWidget : disconnect( "visibilityChanged(bool)" )
|
||||
::oFormatDock:oWidget : disconnect( "visibilityChanged(bool)" )
|
||||
::oCuiEdDock:oWidget : disconnect( "visibilityChanged(bool)" )
|
||||
::oUiSrcDock:oWidget : disconnect( "visibilityChanged(bool)" )
|
||||
|
||||
#if 0 /* Not Implemented */
|
||||
::oDockPT:oWidget : disconnect( "visibilityChanged(bool)" )
|
||||
@@ -284,6 +287,7 @@ METHOD IdeDocks:destroy()
|
||||
::oIde:oReportsManagerDock := NIL
|
||||
::oIde:oFormatDock := NIL
|
||||
::oIde:oCuiEdDock := NIL
|
||||
::oIde:oUiSrcDock := NIL
|
||||
|
||||
::oIde:oDockPT := NIL
|
||||
::oIde:oDockED := NIL
|
||||
@@ -506,6 +510,7 @@ METHOD IdeDocks:buildDockWidgets()
|
||||
::buildReportsDesignerWidget()
|
||||
::buildFormatWidget()
|
||||
::buildCuiEdWidget()
|
||||
::buildUiSrcDock()
|
||||
|
||||
/* Bottom Docks */
|
||||
::oDlg:oWidget:tabifyDockWidget( ::oDockB:oWidget , ::oDockB1:oWidget )
|
||||
@@ -526,6 +531,7 @@ METHOD IdeDocks:buildDockWidgets()
|
||||
::oDlg:oWidget:tabifyDockWidget( ::oQScintillaDock:oWidget , ::oReportsManagerDock:oWidget )
|
||||
::oDlg:oWidget:tabifyDockWidget( ::oReportsManagerDock:oWidget , ::oFormatDock:oWidget )
|
||||
::oDlg:oWidget:tabifyDockWidget( ::oFormatDock:oWidget , ::oCuiEdDock:oWidget )
|
||||
::oDlg:oWidget:tabifyDockWidget( ::oCuiEdDock:oWidget , ::oUiSrcDock:oWidget )
|
||||
|
||||
RETURN Self
|
||||
|
||||
@@ -565,6 +571,13 @@ METHOD IdeDocks:execEvent( cEvent, p, p1 )
|
||||
ENDIF
|
||||
|
||||
SWITCH cEvent
|
||||
CASE "dockUISrc_visibilityChanged"
|
||||
IF p; ::oUiS:show(); ENDIF
|
||||
IF ! p .AND. ! p1:isVisible()
|
||||
p1:raise()
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE "dockCuiEd_visibilityChanged"
|
||||
IF p; ::oCUI:show(); ENDIF
|
||||
IF ! p .AND. ! p1:isVisible()
|
||||
@@ -1375,6 +1388,7 @@ METHOD IdeDocks:buildToolBarPanels()
|
||||
aadd( aBtns, { ::oQScintillaDock , "browser" } )
|
||||
aadd( aBtns, { ::oReportsManagerDock , "designer" } )
|
||||
aadd( aBtns, { ::oCuiEdDock , "cuied" } )
|
||||
aadd( aBtns, { ::oUiSrcDock , "fileprg" } )
|
||||
aadd( aBtns, {} )
|
||||
aadd( aBtns, { ::oDockB2 , "builderror" } )
|
||||
|
||||
@@ -1995,3 +2009,14 @@ METHOD IdeDocks:buildCuiEdWidget()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeDocks:buildUISrcDock()
|
||||
LOCAL nAreas := Qt_LeftDockWidgetArea + Qt_RightDockWidgetArea + Qt_TopDockWidgetArea + Qt_BottomDockWidgetArea
|
||||
|
||||
::oIde:oUISrcDock := ::getADockWidget( nAreas, "dockUISrc", "UI Source Manager", QDockWidget_DockWidgetFloatable )
|
||||
::oDlg:oWidget:addDockWidget( Qt_RightDockWidgetArea, ::oUISrcDock:oWidget, Qt_Horizontal )
|
||||
::oUISrcDock:oWidget:connect( "visibilityChanged(bool)", {|p| ::execEvent( "dockUISrc_visibilityChanged", p, ::oUISrcDock:oWidget ) } )
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -205,8 +205,8 @@ METHOD IdeEnvironments:prepareBatch( cEnvName )
|
||||
|
||||
IF ( n := ascan( ::aEnvrns, {|e_| e_[ 1 ] == cEnvName } ) ) > 0
|
||||
FOR EACH a_ IN ::aEnvrns[ n, 2 ]
|
||||
s := a_[ 1 ]
|
||||
IF s == "content"
|
||||
s := lower( a_[ 1 ] )
|
||||
IF s == "content" .OR. s == "contents"
|
||||
aadd( aCmd, a_[ 2 ] )
|
||||
ENDIF
|
||||
NEXT
|
||||
@@ -214,6 +214,8 @@ METHOD IdeEnvironments:prepareBatch( cEnvName )
|
||||
hb_fNameSplit( hb_dirBase(), @cPath )
|
||||
IF hb_fileExists( cPath + hb_ps() + "hbmk2.exe" )
|
||||
aadd( aCmd, "SET PATH=" + cPath + ";%PATH%" )
|
||||
ELSEIF hb_fileExists( cPath + hb_ps() + "hbmk2" )
|
||||
aadd( aCmd, "SET PATH=" + cPath + ";%PATH%" )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
|
||||
@@ -121,9 +121,6 @@ FUNCTION Main( ... )
|
||||
hb_setEnv( "HB_IDE_INSTALL", cBse )
|
||||
#endif
|
||||
|
||||
SET DATE TO ANSI
|
||||
SET CENTURY ON
|
||||
SET EPOCH TO 1970
|
||||
|
||||
#ifdef __HBDYNLOAD__RDDADS__
|
||||
IF hb_FileExists( tmp := hb_dirBase() + hb_libName( "rddads" + hb_libPostfix() ) )
|
||||
@@ -134,17 +131,18 @@ FUNCTION Main( ... )
|
||||
ENDIF
|
||||
ENDIF
|
||||
#endif
|
||||
SET DATE TO ANSI
|
||||
SET CENTURY ON
|
||||
SET EPOCH TO 1970
|
||||
|
||||
QResource():registerResource_1( hbqtres_HbIde(), ":/resource" )
|
||||
|
||||
oTmp := HbIde():new( hb_aParams() )
|
||||
oIde := oTmp:create()
|
||||
//oIde:oDlg:destroy()
|
||||
//oIde:destroy()
|
||||
oIde:destroy()
|
||||
oTmp := NIL
|
||||
//oIde := oIde
|
||||
|
||||
RETURN oIde
|
||||
RETURN NIL
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -176,6 +174,7 @@ CLASS HbIde
|
||||
DATA oFmt /* Code Formatter Manager */
|
||||
DATA oCL /* ChangeLog Manager */
|
||||
DATA oCUI /* CUI Screen Designer Console */
|
||||
DATA oUiS /* UI Source Writer */
|
||||
|
||||
DATA nRunMode INIT HBIDE_RUN_MODE_INI
|
||||
DATA nAnimantionMode INIT HBIDE_ANIMATION_NONE
|
||||
@@ -272,6 +271,7 @@ CLASS HbIde
|
||||
DATA oReportsManagerDock
|
||||
DATA oFormatDock
|
||||
DATA oCuiEdDock
|
||||
DATA oUISrcDock
|
||||
|
||||
DATA qAnimateAction
|
||||
DATA qStatusBarAction
|
||||
@@ -572,6 +572,9 @@ METHOD HbIde:create( aParams )
|
||||
/* Skeletons Manager */
|
||||
::oSK := IdeSkeletons():new( Self ):create()
|
||||
|
||||
/* Initiate UI Source Manager */
|
||||
::oUiS := IdeUISrcManager():new( Self ):create()
|
||||
|
||||
/* Initialte Project Manager */
|
||||
::oPM := IdeProjManager():new( Self ):create()
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ CLASS IdeObject
|
||||
ACCESS oFmt INLINE ::oIde:oFmt
|
||||
ACCESS oCL INLINE ::oIde:oCL
|
||||
ACCESS oCUI INLINE ::oIde:oCUI
|
||||
ACCESS oUiS INLINE ::oIde:oUiS
|
||||
|
||||
ACCESS aMeta INLINE ::oIde:aMeta
|
||||
ACCESS aTags INLINE ::oIde:aTags
|
||||
@@ -204,6 +205,7 @@ CLASS IdeObject
|
||||
ACCESS oSys INLINE ::oIde:oSys
|
||||
ACCESS oSysMenu INLINE ::oIde:oSysMenu
|
||||
ACCESS oCuiEdDock INLINE ::oIde:oCuiEdDock
|
||||
ACCESS oUISrcDock INLINE ::oIde:oUISrcDock
|
||||
|
||||
ACCESS lProjTreeVisible INLINE ::oIde:lProjTreeVisible
|
||||
ACCESS lDockRVisible INLINE ::oIde:lDockRVisible
|
||||
|
||||
952
harbour/contrib/hbide/ideuisrcmanager.prg
Normal file
952
harbour/contrib/hbide/ideuisrcmanager.prg
Normal file
@@ -0,0 +1,952 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
*
|
||||
* Copyright 2012 Pritpal Bedi <bedipritpal@hotmail.com>
|
||||
* www - http://harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* EkOnkar
|
||||
* ( The LORD is ONE )
|
||||
*
|
||||
* Harbour-Qt IDE
|
||||
*
|
||||
* Pritpal Bedi <bedipritpal@hotmail.com>
|
||||
* 28Feb2012
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "common.ch"
|
||||
#include "hbclass.ch"
|
||||
#include "hbqtgui.ch"
|
||||
#include "hbide.ch"
|
||||
#include "hbhrb.ch"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#define PNL_UI 1
|
||||
#define PNL_OBJECTS 2
|
||||
#define PNL_TYPE 3
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
// CLASS UISrcData
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
CLASS UISrcData
|
||||
|
||||
DATA qObj
|
||||
DATA cName INIT ""
|
||||
DATA hSource INIT {=>}
|
||||
|
||||
METHOD new( qObj, cObj )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD UISrcData:new( qObj, cObj )
|
||||
|
||||
hb_hCaseMatch( ::hSource, .f. )
|
||||
|
||||
::qObj := qObj
|
||||
::cName := cObj
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
// CLASS IdeUISrcManager
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
CLASS IdeUISrcManager INHERIT IdeObject
|
||||
|
||||
DATA qU
|
||||
DATA qMdiArea
|
||||
DATA qMdiSub
|
||||
DATA qWidget
|
||||
DATA qToolbar
|
||||
DATA qLayout
|
||||
DATA qStatus
|
||||
DATA aStatusPnls INIT {}
|
||||
DATA aToolBtns INIT {}
|
||||
DATA sp0
|
||||
DATA pHrb
|
||||
DATA qWdg
|
||||
DATA qFocus
|
||||
DATA qCurrent
|
||||
DATA qTree
|
||||
DATA qEdit
|
||||
DATA qFont
|
||||
DATA qSplitter
|
||||
DATA qFrame
|
||||
DATA qHBLayout
|
||||
DATA qHiliter
|
||||
|
||||
DATA oEdit
|
||||
|
||||
DATA hMethods INIT {=>}
|
||||
DATA hObjects INIT {=>}
|
||||
DATA cPath INIT ""
|
||||
DATA cName INIT ""
|
||||
DATA cExt INIT ""
|
||||
DATA lChanged INIT .f.
|
||||
DATA aPrg INIT {}
|
||||
DATA aObjByName INIT {}
|
||||
DATA cSrcFile INIT ""
|
||||
DATA cSource INIT ""
|
||||
DATA aSource INIT {}
|
||||
DATA cBatch INIT ""
|
||||
DATA oProcess
|
||||
DATA lFinished
|
||||
DATA cCurAction INIT ""
|
||||
|
||||
METHOD new( oIde )
|
||||
METHOD create( oIde )
|
||||
METHOD show()
|
||||
METHOD destroy()
|
||||
METHOD execEvent( cEvent, p, p1 )
|
||||
METHOD buildToolbar()
|
||||
METHOD buildToolButton( qToolbar, aBtn )
|
||||
METHOD buildStatusPanels()
|
||||
METHOD buildUiWidget( cUI )
|
||||
METHOD buildWidget( cBuffer, cPath, cName, cExt, aPrg )
|
||||
METHOD runHbmk2( cUI )
|
||||
METHOD clear()
|
||||
METHOD checkUpdates()
|
||||
METHOD buildSource()
|
||||
METHOD loadSource()
|
||||
METHOD finished( nExitCode, nExitStatus )
|
||||
METHOD outputText( cText )
|
||||
METHOD loadActions( oWidget, cName )
|
||||
METHOD exposeAction()
|
||||
METHOD loadMethod( cObjName, cAction )
|
||||
METHOD saveMethod( cObjName, cAction )
|
||||
|
||||
ENDCLASS
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:new( oIde )
|
||||
|
||||
::oIde := oIde
|
||||
|
||||
hb_hKeepOrder( ::hObjects, .t. )
|
||||
hb_hCaseMatch( ::hObjects, .f. )
|
||||
|
||||
hb_hKeepOrder( ::hMethods, .t. )
|
||||
hb_hCaseMatch( ::hMethods, .f. )
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:create( oIde )
|
||||
|
||||
DEFAULT oIde TO ::oIde
|
||||
::oIde := oIde
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:show()
|
||||
LOCAL qDock
|
||||
|
||||
IF ! empty( ::oUI )
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
::oUI := 1
|
||||
|
||||
qDock := ::oIde:oUiSrcDock:oWidget
|
||||
|
||||
qDock:setAcceptDrops( .t. )
|
||||
qDock:connect( QEvent_DragEnter, {|p| ::execEvent( "dockUIScr_dragEnterEvent", p ) } )
|
||||
qDock:connect( QEvent_Drop , {|p| ::execEvent( "dockUISrc_dropEvent" , p ) } )
|
||||
|
||||
::qWidget := QWidget()
|
||||
|
||||
qDock:setWidget( ::qWidget )
|
||||
|
||||
/* Layout applied to dbu widget */
|
||||
::qLayout := QGridLayout()
|
||||
::qLayout:setContentsMargins( 0,0,0,0 )
|
||||
::qLayout:setSpacing( 0 )
|
||||
|
||||
::qWidget:setLayout( ::qLayout )
|
||||
|
||||
/* Toolbar */
|
||||
::buildToolbar()
|
||||
::qLayout:addWidget( ::qToolbar, 0, 0, 1, 1 )
|
||||
|
||||
::qSplitter := QSplitter()
|
||||
::qSplitter:setOrientation( Qt_Vertical )
|
||||
::qLayout:addWidget( ::qSplitter, 1, 0, 1, 1 )
|
||||
|
||||
/* StatusBar */
|
||||
::qStatus := QStatusBar()
|
||||
::qStatus:setSizeGripEnabled( .f. )
|
||||
::qLayout:addWidget( ::qStatus , 2, 0, 1, 1 )
|
||||
|
||||
::qMdiArea := QMdiArea()
|
||||
::qMdiArea:setDocumentMode( .t. )
|
||||
::qMdiArea:setOption( QMdiArea_DontMaximizeSubWindowOnActivation, .t. )
|
||||
::qMdiArea:setVerticalScrollBarPolicy( Qt_ScrollBarAsNeeded )
|
||||
::qMdiArea:setHorizontalScrollBarPolicy( Qt_ScrollBarAsNeeded )
|
||||
::qMdiArea:setViewMode( QMdiArea_SubWindowView )
|
||||
::qMdiArea:connect( "subWindowActivated(QMdiSubWindow*)", {|p| ::execEvent( "mdiArea_subWindowActivated", p ) } )
|
||||
|
||||
::qSplitter:addWidget( ::qMdiArea )
|
||||
|
||||
::qFrame := QFrame()
|
||||
::qHBLayout := QHBoxLayout()
|
||||
::qFrame:setLayout( ::qHBLayout )
|
||||
|
||||
::qSplitter:addWidget( ::qFrame )
|
||||
|
||||
::qTree := QTreeWidget()
|
||||
::qTree:setMaximumWidth( 150 )
|
||||
::qTree:setHeaderHidden( .t. )
|
||||
::qTree:setAlternatingRowColors( .t. )
|
||||
::qTree:connect( "itemSelectionChanged()", {|| ::exposeAction() } )
|
||||
::qHBLayout:addWidget( ::qTree )
|
||||
|
||||
::qEdit := QPlainTextEdit()
|
||||
::qHBLayout:addWidget( ::qEdit )
|
||||
|
||||
::oEdit := IdeEdit():new( ::oIde )
|
||||
::oEdit:qEdit := ::qEdit
|
||||
|
||||
::qFont := QFont()
|
||||
::qFont:setFamily( "Courier" )
|
||||
::qFont:setFixedPitch( .t. )
|
||||
::qFont:setPointSize( 10 )
|
||||
::qEdit:setFont( ::qFont )
|
||||
|
||||
::qEdit:setLineWrapMode( QTextEdit_NoWrap )
|
||||
::qEdit:setFont( ::oIde:oFont:oWidget )
|
||||
::qEdit:ensureCursorVisible()
|
||||
|
||||
::qHiliter := ::oTH:setSyntaxHilighting( ::qEdit, "Bare Minimum", .t., .t. )
|
||||
::qHiliter:hbSetInitialized( .t. )
|
||||
|
||||
/* Statusbar Panels */
|
||||
::buildStatusPanels()
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:destroy()
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:execEvent( cEvent, p, p1 )
|
||||
LOCAL qList, qMime, qUrl, cExt, cUI
|
||||
|
||||
SWITCH cEvent
|
||||
CASE "buttonBuild_clicked"
|
||||
::buildSource()
|
||||
EXIT
|
||||
|
||||
CASE "buttonOpen_clicked"
|
||||
IF ! empty( cUI := hbide_fetchAFile( ::oIde:oDlg, "Select a .UIC", { { "Qt Designer .UIC File", "*.uic" } }, ::oIde:cWrkFolderLast ) )
|
||||
::buildUiWidget( cUI )
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE "dockUIScr_dragEnterEvent"
|
||||
p:acceptProposedAction()
|
||||
EXIT
|
||||
|
||||
CASE "dockUISrc_dropEvent"
|
||||
qMime := p:mimeData()
|
||||
IF qMime:hasUrls()
|
||||
qList := qMime:urls()
|
||||
qUrl := qList:at( 0 )
|
||||
hb_fNameSplit( qUrl:toLocalFile(), , , @cExt )
|
||||
IF lower( cExt ) == ".uic"
|
||||
::buildUicWidget( qUrl:toLocalFile() )
|
||||
ELSEIF lower( cExt ) == ".ui"
|
||||
::buildUiWidget( qUrl:toLocalFile() )
|
||||
ENDIF
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE "child_object"
|
||||
IF empty( ::qCurrent ) .OR. ! ( ::qCurrent == p )
|
||||
IF ! empty( ::cCurAction )
|
||||
::saveMethod( ::qCurrent:objectName(), ::cCurAction )
|
||||
ENDIF
|
||||
::qCurrent := p
|
||||
::qFocus:setWidget( p )
|
||||
::aStatusPnls[ PNL_OBJECTS ]:setText( "<font color = blue>OBJ: " + p1 + "</font>" )
|
||||
::aStatusPnls[ PNL_TYPE ]:setText( "<font color = green>CLASS: " + lower(__objGetClsName( p ) ) + "</font>" )
|
||||
p:clearFocus()
|
||||
::loadActions( p, p1 )
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
CASE "mdiArea_subWindowActivated"
|
||||
EXIT
|
||||
|
||||
ENDSWITCH
|
||||
|
||||
RETURN .f.
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:saveMethod( cObjName, cAction )
|
||||
LOCAL cSrc, n, n0, n1, n2, n3, cMtd, i, aSrc
|
||||
LOCAL cMethod := cObjName + "_" + upper( left( cAction,1 ) ) + lower( substr( cAction, 2 ) )
|
||||
|
||||
cMtd := "METHOD " + "ui_" + ::cName + ":" + cMethod + "( ... )"
|
||||
cSrc := ::qEdit:toPlainText()
|
||||
|
||||
n0 := ascan( ::aSource, {|e| "<METHODSEVENTS>" $ e } )
|
||||
n1 := ascan( ::aSource, {|e| "</METHODSEVENTS>" $ e } )
|
||||
|
||||
n2 := ascan( ::aSource, {|e| "METHOD " + cMethod $ e }, n0, n1 )
|
||||
IF n2 > 0 .AND. empty( cSrc )
|
||||
hb_adel( ::aSource, n2, .t. )
|
||||
ELSEIF n2 == 0 .AND. ! empty( cSrc )
|
||||
::aSource := hb_aIns( ::aSource, n0+1, " " + "METHOD " + cMethod + "( ... )", .t. )
|
||||
ENDIF
|
||||
|
||||
n2 := ascan( ::aSource, {|e| cMtd $ e } )
|
||||
n3 := ascan( ::aSource, {|e| "RETURN Self" $ e }, n2 )
|
||||
|
||||
IF empty( cSrc )
|
||||
IF n2 > 0
|
||||
FOR i := n3 + 1 TO n2 STEP - 1
|
||||
hb_adel( ::aSource, i, .t. )
|
||||
NEXT
|
||||
ENDIF
|
||||
ELSE
|
||||
cSrc := strtran( cSrc, chr( 13 ) + chr( 10 ), chr( 10 ) )
|
||||
aSrc := hb_aTokens( cSrc, chr( 10 ) )
|
||||
|
||||
IF n2 > 0
|
||||
FOR i := n3-1 TO n2 + 1 STEP - 1
|
||||
hb_adel( ::aSource, i, .t. )
|
||||
NEXT
|
||||
FOR i := 1 TO len( aSrc )
|
||||
::aSource := hb_ains( ::aSource, n2 + i, " " + aSrc[ i ], .t. )
|
||||
NEXT
|
||||
ELSE
|
||||
n := ascan( ::aSource, {|e| "<EVENTSMETHODAREA>" $ e } )
|
||||
::aSource := hb_ains( ::aSource, ++n, cMtd, .t. )
|
||||
FOR i := 1 TO len( aSrc )
|
||||
::aSource := hb_ains( ::aSource, ++n, " " + aSrc[ i ], .t. )
|
||||
NEXT
|
||||
::aSource := hb_ains( ::aSource, ++n, " ", .t. )
|
||||
::aSource := hb_ains( ::aSource, ++n, " RETURN Self", .t. )
|
||||
::aSource := hb_ains( ::aSource, ++n, " ", .t. )
|
||||
ENDIF
|
||||
ENDIF
|
||||
#if 0
|
||||
n0 := ascan( ::aSource, {|e| "<CONNECTS>" $ e } )
|
||||
n1 := ascan( ::aSource, {|e| "</CONNECTS>" $ e } )
|
||||
IF empty( cSrc )
|
||||
|
||||
ELSE
|
||||
|
||||
ENDIF
|
||||
#endif
|
||||
::qEdit:document():clear()
|
||||
::buildSource() /* Temporary */
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:loadMethod( cObjName, cAction )
|
||||
LOCAL cSrc := "", n0, n1, n2, n3, cMtd, i
|
||||
LOCAL cMethod := cObjName + "_" + upper( left( cAction,1 ) ) + lower( substr( cAction, 2 ) )
|
||||
|
||||
n0 := ascan( ::aSource, {|e| "<METHODSEVENTS>" $ e } )
|
||||
n1 := ascan( ::aSource, {|e| "</METHODSEVENTS>" $ e } )
|
||||
|
||||
n2 := ascan( ::aSource, {|e| "METHOD " + cMethod $ e }, n0, n1 )
|
||||
IF n2 > 0
|
||||
cMtd := "METHOD " + "ui_" + ::cName + ":" + cMethod + "( ... )"
|
||||
IF ( n2 := ascan( ::aSource, {|e| cMtd $ e } ) ) > 0
|
||||
n3 := ascan( ::aSource, {|e| "RETURN Self" $ e }, n2 )
|
||||
FOR i := n2 + 1 TO n3 - 1
|
||||
cSrc += substr( ::aSource[ i ], 4 ) + chr( 10 )
|
||||
NEXT
|
||||
cSrc := substr( cSrc, 1, len( cSrc ) - 1 )
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN cSrc
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:exposeAction()
|
||||
LOCAL qItem := ::qTree:currentItem()
|
||||
LOCAL cText := qItem:text( 0 )
|
||||
|
||||
IF cText == ::cCurAction
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
IF ! empty( ::cCurAction )
|
||||
::saveMethod( ::qCurrent:objectName(), ::cCurAction )
|
||||
ENDIF
|
||||
|
||||
SWITCH __objGetClsName( ::qCurrent )
|
||||
CASE "QPUSHBUTTON"
|
||||
CASE "QTOOLBUTTON"
|
||||
SWITCH cText
|
||||
CASE "Activated"
|
||||
::qEdit:setPlainText( ::loadMethod( ::qCurrent:objectName(), "Activated" ) )
|
||||
::qEdit:setFocus()
|
||||
EXIT
|
||||
CASE "Tooltip"
|
||||
::qEdit:setPlainText( ::loadMethod( ::qCurrent:objectName(), "Tooltip" ) )
|
||||
::qEdit:setFocus()
|
||||
EXIT
|
||||
ENDSWITCH
|
||||
|
||||
EXIT
|
||||
|
||||
ENDSWITCH
|
||||
|
||||
::cCurAction := cText
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:loadActions( oWidget, cName )
|
||||
LOCAL qItem
|
||||
|
||||
HB_SYMBOL_UNUSED( cName )
|
||||
|
||||
::qTree:clear()
|
||||
|
||||
SWITCH __objGetClsName( oWidget )
|
||||
CASE "QPUSHBUTTON"
|
||||
CASE "QTOOLBUTTON"
|
||||
qItem := QTreeWidgetItem()
|
||||
qItem:setText( 0, "Activated" )
|
||||
::qTree:addTopLevelItem( qItem )
|
||||
qItem := QTreeWidgetItem()
|
||||
qItem:setText( 0, "Tooltip" )
|
||||
::qTree:addTopLevelItem( qItem )
|
||||
EXIT
|
||||
|
||||
ENDSWITCH
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:checkUpdates()
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:clear()
|
||||
|
||||
::qEdit:document():clear()
|
||||
::qTree:clear()
|
||||
|
||||
::aObjByName := {}
|
||||
::aPrg := {}
|
||||
::qFocus := NIL
|
||||
::qFocus := QFocusFrame()
|
||||
|
||||
IF ! empty( ::pHrb )
|
||||
hb_hrbUnload( ::pHrb )
|
||||
::pHrb := NIL
|
||||
ENDIF
|
||||
|
||||
IF hb_isObject( ::qMdiSub )
|
||||
::qMdiArea:removeSubWindow( ::qMdiSub )
|
||||
::qMdiSub := NIL
|
||||
ENDIF
|
||||
|
||||
::hObjects := {=>}
|
||||
hb_hCaseMatch( ::hObjects, .f. )
|
||||
hb_hKeepOrder( ::hObjects, .t. )
|
||||
|
||||
::cSource := ""
|
||||
::cSrcFile := ""
|
||||
::aSource := {}
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:buildUiWidget( cUI )
|
||||
LOCAL cPath, cName, cExt, cBuffer, cPrg, aPrg
|
||||
|
||||
hb_fNameSplit( cUI, @cPath, @cName, @cExt )
|
||||
|
||||
::lFinished := .f.
|
||||
::runHbmk2( cUI )
|
||||
DO WHILE ! ::lFinished
|
||||
QApplication():processEvents()
|
||||
ENDDO
|
||||
|
||||
cPrg := cPath + "uic_" + cName + ".prg"
|
||||
IF ! hb_fileExists( cPrg )
|
||||
RETURN Self
|
||||
ENDIF
|
||||
cBuffer := hb_memoRead( cPrg )
|
||||
|
||||
cBuffer := strtran( cBuffer, "hbqtui_", "hbide_ui_" )
|
||||
ferase( cPrg )
|
||||
|
||||
IF !( hb_eol() == Chr( 10 ) )
|
||||
cBuffer := StrTran( cBuffer, hb_eol(), Chr( 10 ) )
|
||||
ENDIF
|
||||
IF !( hb_eol() == Chr( 13 ) + Chr( 10 ) )
|
||||
cBuffer := StrTran( cBuffer, Chr( 13 ) + Chr( 10 ), Chr( 10 ) )
|
||||
ENDIF
|
||||
aPrg := hb_aTokens( cBuffer, chr( 10 ) )
|
||||
|
||||
::buildWidget( cBuffer, cPath, cName, cExt, aPrg )
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:buildWidget( cBuffer, cPath, cName, cExt, aPrg )
|
||||
LOCAL cCode, s, n, cObj, cCls, i, pHrb, oObj
|
||||
|
||||
cBuffer := hb_compileFromBuf( cBuffer, "-n2", "-w3", "-es2", "-q0", "-i" + ::oHL:cPathInstall + "include" )
|
||||
IF ! empty( cBuffer )
|
||||
pHrb := hb_hrbLoad( HB_HRB_BIND_OVERLOAD, cBuffer )
|
||||
IF ! empty( pHrb )
|
||||
::checkUpdates()
|
||||
::clear()
|
||||
|
||||
::aPrg := aPrg
|
||||
::pHrb := pHrb
|
||||
::cPath := lower( cPath )
|
||||
::cName := lower( cName )
|
||||
::cExt := lower( cExt )
|
||||
::cSrcFile := ::cPath + "cls_" + ::cName + ".prg"
|
||||
|
||||
::qU := eval( &( "{|q| " + "hbide_ui_" + cName + "( q ) }" ) )
|
||||
IF hb_isObject( ::qU )
|
||||
::loadSource()
|
||||
|
||||
::qMdiSub := QMdiSubWindow()
|
||||
::qMdiSub:setWidget( ::qU:oWidget )
|
||||
::qMdiSub:resize( ::qU:width()+8, ::qU:height()+40 )
|
||||
::qMdiArea:addSubWindow( ::qMdiSub )
|
||||
::qMdiSub:show()
|
||||
::qMdiSub:move( 10,10 )
|
||||
::aStatusPnls[ PNL_UI ]:setText( "<font color = red >UI: " + cName + "</font>" )
|
||||
|
||||
FOR i := 1 to len( aPrg )
|
||||
cCode := aPrg[ i ]
|
||||
IF " := " $ cCode
|
||||
IF ! ( "oRootWidget" $ cCode ) .AND. ! ( "LOCAL" $ cCode )
|
||||
s := substr( cCode, 1, at( " := ", cCode ) )
|
||||
n := at( '"', s )
|
||||
s := substr( s, n+1 )
|
||||
n := at( '"', s )
|
||||
cObj := substr( s, 1, n-1 )
|
||||
oObj := ::qU:qObj[ cObj ]
|
||||
cCls := __objGetClsName( oObj )
|
||||
IF ! ( cCls $ "QSIZEPOLICY,QFONT,QGRIDLAYOUT,QHBOXLAYOUT,QVBOXLAYOUT,QSPACERITEM,QLAYOUT,QSPLITTER,QSCROLLAREA,QTREEWIDGETITEM,QLISTWIDGETITEM" )
|
||||
aadd( ::aObjByName, cObj )
|
||||
oObj:setObjectName( cObj )
|
||||
|
||||
IF ( cCls $ "QLINEEDIT" )
|
||||
oObj:setFocusPolicy( Qt_NoFocus )
|
||||
ENDIF
|
||||
|
||||
SWITCH cCls
|
||||
CASE "QPLAINTEXTEDIT"
|
||||
CASE "QTEXTEDIT"
|
||||
oObj:connect( QEvent_FocusIn, getObject( Self, ::qU, cObj ) )
|
||||
oObj:setCursorWidth( 0 )
|
||||
EXIT
|
||||
OTHERWISE
|
||||
oObj:connect( QEvent_MouseButtonRelease, getObject( Self, ::qU, cObj ) )
|
||||
ENDSWITCH
|
||||
|
||||
::hObjects[ cObj ] := UISrcData():new( oObj, cObj )
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
ENDIF
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
RETURN .t.
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:runHbmk2( cUI )
|
||||
LOCAL cPath, cName, cExt, cExeHbMk2, cCmdParams, cCmd, cC, cBuf
|
||||
LOCAL aHbp := {}
|
||||
LOCAL cbRed := "<font color=blue>", ceRed := "</font>"
|
||||
|
||||
hb_fNameSplit( cUI, @cPath, @cName, @cExt )
|
||||
|
||||
aadd( aHbp, "-q" )
|
||||
aadd( aHbp, "-trace" )
|
||||
aadd( aHbp, "-info" )
|
||||
aadd( aHbp, "-lang=en" )
|
||||
aadd( aHbp, "-width=512" )
|
||||
aadd( aHbp, "-rebuild" )
|
||||
aadd( aHbp, "-s" )
|
||||
aadd( aHbp, "-hblib" )
|
||||
aadd( aHbp, "-hbraw" )
|
||||
aadd( aHbp, "-workdir=" + cPath )
|
||||
aadd( aHbp, "hbqt.hbc" )
|
||||
aadd( aHbp, cUI )
|
||||
|
||||
::oDockB2:show()
|
||||
::oOutputResult:oWidget:clear()
|
||||
|
||||
IF .t.
|
||||
::oOutputResult:oWidget:append( hbide_outputLine() )
|
||||
|
||||
::oIDE:oEV := IdeEnvironments():new():create( ::oIDE )
|
||||
::cBatch := ::oEV:prepareBatch( ::cWrkEnvironment )
|
||||
aeval( ::oEV:getHbmk2Commands( ::cWrkEnvironment ), {|e| aadd( aHbp, e ) } )
|
||||
|
||||
cExeHbMk2 := ::oINI:getHbmk2File()
|
||||
cCmdParams := hbide_array2cmdParams( aHbp )
|
||||
|
||||
::oProcess := HbpProcess():new()
|
||||
//
|
||||
::oProcess:output := {|cOut| hbide_convertBuildStatusMsgToHtml( cOut, ::oOutputResult:oWidget ) }
|
||||
::oProcess:finished := {|nEC , nES| ::finished( nEC ,nES ) }
|
||||
::oProcess:workingPath := cPath
|
||||
//
|
||||
cCmd := hbide_getShellCommand()
|
||||
cC := iif( hbide_getOS() == "nix", "", "/C " )
|
||||
|
||||
IF hb_fileExists( ::cBatch )
|
||||
cBuf := memoread( ::cBatch )
|
||||
cBuf += hb_eol() + cExeHbMk2 + " " + cCmdParams + hb_eol()
|
||||
hb_memowrit( ::cBatch, cBuf )
|
||||
ENDIF
|
||||
//
|
||||
::outputText( cbRed + "Batch File " + iif( hb_fileExists( ::cBatch ), " Exists", " : doesn't Exist" ) + " => " + ceRed + trim( ::cBatch ) )
|
||||
::outputText( cbRed + "Batch File Contents => " + ceRed )
|
||||
::outputText( memoread( ::cBatch ) )
|
||||
::outputText( cbRed + "Command => " + ceRed + cCmd )
|
||||
::outputText( cbRed + "Arguments => " + ceRed + cC + ::cBatch )
|
||||
::outputText( hbide_outputLine() )
|
||||
//
|
||||
::oProcess:addArg( cC + ::cBatch )
|
||||
::oProcess:start( cCmd )
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:finished( nExitCode, nExitStatus )
|
||||
LOCAL cTmp
|
||||
|
||||
::outputText( hbide_outputLine() )
|
||||
cTmp := "Exit Code [ " + hb_ntos( nExitCode ) + " ] Exit Status [ " + hb_ntos( nExitStatus ) + " ] " +;
|
||||
"Finished at [ " + time() + " ] Done in [ " + hb_ntos( seconds() - ::oProcess:started ) + " Secs ]"
|
||||
::outputText( cTmp )
|
||||
::outputText( hbide_outputLine() )
|
||||
|
||||
ferase( ::cBatch )
|
||||
::lFinished := .t.
|
||||
::oDockB2:hide()
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:outputText( cText )
|
||||
::oOutputResult:oWidget:append( "<font color=black>" + cText + "</font>" )
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:buildToolbar()
|
||||
LOCAL nW := 25
|
||||
|
||||
::sp0 := QLabel()
|
||||
::sp0:setMinimumWidth( nW )
|
||||
|
||||
::qToolbar := QToolbar()
|
||||
::qToolbar:setIconSize( QSize( 16,16 ) )
|
||||
::qToolbar:setStyleSheet( GetStyleSheet( "QToolBar", ::nAnimantionMode ) )
|
||||
|
||||
::buildToolButton( ::qToolbar, { "Open a .UI" , "open3" , {|| ::execEvent( "buttonOpen_clicked" ) }, .f. } )
|
||||
::qToolbar:addWidget( ::sp0 )
|
||||
::buildToolButton( ::qToolbar, { "Build Source", "fileprg", {|| ::execEvent( "buttonBuild_clicked" ) }, .f. } )
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:buildToolButton( qToolbar, aBtn )
|
||||
LOCAL qBtn
|
||||
|
||||
IF empty( aBtn )
|
||||
qToolbar:addSeparator()
|
||||
ELSE
|
||||
qBtn := QToolButton()
|
||||
qBtn:setTooltip( aBtn[ 1 ] )
|
||||
qBtn:setAutoRaise( .t. )
|
||||
qBtn:setIcon( hbide_image( aBtn[ 2 ] ) )
|
||||
IF aBtn[ 4 ]
|
||||
qBtn:setCheckable( .t. )
|
||||
ENDIF
|
||||
qBtn:connect( "clicked()", aBtn[ 3 ] )
|
||||
qToolBar:addWidget( qBtn )
|
||||
aadd( ::aToolBtns, qBtn )
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:buildStatusPanels()
|
||||
LOCAL qLabel
|
||||
|
||||
qLabel := QLabel(); qLabel:setMinimumWidth( 40 )
|
||||
::qStatus:addPermanentWidget( qLabel, 0 )
|
||||
aadd( ::aStatusPnls, qLabel )
|
||||
|
||||
qLabel := QLabel(); qLabel:setMinimumWidth( 40 )
|
||||
::qStatus:addPermanentWidget( qLabel, 0 )
|
||||
aadd( ::aStatusPnls, qLabel )
|
||||
|
||||
qLabel := QLabel(); qLabel:setMinimumWidth( 40 )
|
||||
::qStatus:addPermanentWidget( qLabel, 0 )
|
||||
aadd( ::aStatusPnls, qLabel )
|
||||
|
||||
qLabel := QLabel(); qLabel:setMinimumWidth( 40 )
|
||||
::qStatus:addPermanentWidget( qLabel, 1 )
|
||||
aadd( ::aStatusPnls, qLabel )
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
STATIC FUNCTION getObject( oSelf, oHbQtUi, cObj )
|
||||
RETURN {|...| oSelf:execEvent( "child_object", oHbQtUi:qObj[ cObj ], cObj, ... ) }
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:loadSource()
|
||||
|
||||
IF hb_fileExists( ::cSrcFile )
|
||||
::aSource := hbide_readSource( ::cSrcFile )
|
||||
ELSE
|
||||
::buildSource()
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
METHOD IdeUISrcManager:buildSource()
|
||||
LOCAL aSrc, cCls, cClsC
|
||||
|
||||
IF empty( ::aSource )
|
||||
aSrc := {}
|
||||
cCls := 'ui_' + ::cName
|
||||
cClsC := 'ui_' + ::cName + ":"
|
||||
|
||||
aadd( aSrc, '/*' )
|
||||
aadd( aSrc, ' * $Id$' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' <CLASS> . Do not edit lines in this section!' )
|
||||
aadd( aSrc, ' NAME = ' + cCls )
|
||||
aadd( aSrc, ' </CLASS>' )
|
||||
aadd( aSrc, ' */' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '#include "hbclass.ch"' )
|
||||
aadd( aSrc, '#include "common.ch"' )
|
||||
aadd( aSrc, '#include "hbqtgui.ch"' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, 'CLASS ' + cCls )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' /* <METHODSCOMMON> . Do not edit lines in this section! */' )
|
||||
aadd( aSrc, ' METHOD new( oParent )' )
|
||||
aadd( aSrc, ' METHOD create( oParent )' )
|
||||
aadd( aSrc, ' METHOD destroy()' )
|
||||
aadd( aSrc, ' METHOD connects()' )
|
||||
aadd( aSrc, ' METHOD disconnects()' )
|
||||
aadd( aSrc, ' ERROR HANDLER __OnError( ... )' )
|
||||
aadd( aSrc, ' /* </METHODSCOMMON> */' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' /* <METHODSEVENTS> . Do not edit lines in this section! */' )
|
||||
aadd( aSrc, ' /* </METHODSEVENTS> */' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, 'PROTECTED:' )
|
||||
aadd( aSrc, ' DATA oUI' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' ENDCLASS' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, 'METHOD ' + cClsC + 'new( oParent )' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' DEFAULT oParent TO ::oParent' )
|
||||
aadd( aSrc, ' ::oParent := oParent' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' RETURN Self' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, 'METHOD ' + cClsC + 'create( oParent )' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' DEFAULT oParent TO ::oParent' )
|
||||
aadd( aSrc, ' ::oParent := oParent' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' ::oUI := hbqtui_' + ::cName + '( ::oParent )' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' ::connects()' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' RETURN Self' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, 'METHOD ' + cClsC + 'destroy()' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' IF hb_isObject( ::oUI )' )
|
||||
aadd( aSrc, ' ::disconnects()' )
|
||||
aadd( aSrc, ' ::oUI:destroy()' )
|
||||
aadd( aSrc, ' ENDIF' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' RETURN Self' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, 'METHOD ' + cClsC + '__OnError( ... )' )
|
||||
aadd( aSrc, ' LOCAL cMsg := __GetMessage()' )
|
||||
aadd( aSrc, ' LOCAL oError' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' IF SubStr( cMsg, 1, 1 ) == "_"' )
|
||||
aadd( aSrc, ' cMsg := SubStr( cMsg, 2 )' )
|
||||
aadd( aSrc, ' ENDIF' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' IF Left( cMsg, 2 ) == "Q_"' )
|
||||
aadd( aSrc, ' IF SubStr( cMsg, 3 ) $ ::oUI:qObj' )
|
||||
aadd( aSrc, ' RETURN ::oUI:qObj[ SubStr( cMsg, 3 ) ]' )
|
||||
aadd( aSrc, ' ELSE' )
|
||||
aadd( aSrc, ' oError := ErrorNew()' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' oError:severity := ES_ERROR' )
|
||||
aadd( aSrc, ' oError:genCode := EG_ARG' )
|
||||
aadd( aSrc, ' oError:subSystem := "HBQT"' )
|
||||
aadd( aSrc, ' oError:subCode := 1001' )
|
||||
aadd( aSrc, ' oError:canRetry := .F.' )
|
||||
aadd( aSrc, ' oError:canDefault := .F.' )
|
||||
aadd( aSrc, ' oError:Args := hb_AParams()' )
|
||||
aadd( aSrc, ' oError:operation := ProcName()' )
|
||||
aadd( aSrc, ' oError:Description := "Control <" + substr( cMsg, 3 ) + "> does not exist"' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' Eval( ErrorBlock(), oError )' )
|
||||
aadd( aSrc, ' ENDIF' )
|
||||
aadd( aSrc, ' ELSEIF ::oUI:oWidget:hasValidPointer()' )
|
||||
aadd( aSrc, ' RETURN ::oUI:oWidget:&cMsg( ... )' )
|
||||
aadd( aSrc, ' ENDIF' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' RETURN NIL' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, 'METHOD ' + cClsC + 'connects()' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' /* <CONNECTS> . Do not edit lines in this section! */' )
|
||||
aadd( aSrc, ' /* </CONNECTS> */' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' RETURN Self' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, 'METHOD ' + cClsC + 'disconnects()' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' /* <DISCONNECTS> . Do not edit lines in this section! */' )
|
||||
aadd( aSrc, ' /* </DISCONNECTS> */' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, ' RETURN Self' )
|
||||
aadd( aSrc, '' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '/* <EVENTSMETHODAREA> . Do not edit code in this section! */' )
|
||||
aadd( aSrc, '/* </EVENTSMETHODAREA> */' )
|
||||
aadd( aSrc, '/*----------------------------------------------------------------------*/' )
|
||||
aadd( aSrc, '' )
|
||||
|
||||
::aSource := aSrc
|
||||
ENDIF
|
||||
|
||||
::cSource := ""
|
||||
aeval( ::aSource, {|e| ::cSource += e + hb_osNewLine() } )
|
||||
|
||||
hb_memowrit( ::cSrcFile, ::cSource )
|
||||
|
||||
::oSM:editSource( ::cSrcFile, 0, 0, 0, NIL, NIL, .f., .t. )
|
||||
IF ::oEM:isOpen( ::cSrcFile )
|
||||
::oEM:reLoad( ::cSrcFile )
|
||||
ENDIF
|
||||
|
||||
RETURN Self
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user