2010-10-18 00:57 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbqt/qtgui/hbqtgui.hbx
  + contrib/hbqt/qtgui/THbQtUI.prg
  * contrib/hbqt/qtgui/hbqtgui.hbm
  * contrib/hbqt/qtuitools/hbqtuitools.hbm
  * contrib/hbqt/qtuitools/hbqtuitools.hbx
  - contrib/hbqt/qtuitools/THbQtUI.prg
  + contrib/hbqt/qtuitools/THbQtUILoader.prg
  * contrib/hbqt/hbqt_hbmk2_plugin.hbs
    + Added new HbQtUI class (with temp name HbQtUI2) which
      is light version of HbQtUI with no ties to qtuitools/uiloader
      components.
      New class is inheriting from HBQT root class, it
      contains minor optimizations and cleanups.
      It works, but it's not yet activated.
    * Moved Q__TR() to hbqtgui from hbqtuitools.
    ; TODO: Clear all TOFIX/QUESTION/TODO items in THbQtUI.prg.
            F.e. user code like hbide makes quite many direct 
            manipulations on HbQtUI internal variables. This should 
            pbly be fixed.
    ; TODO: Optimize the OnError way of doing things in HbQtUI class.
    * Renamed THbQtUI.prg to THbQtUILoader.prg in hbqtuitools.
This commit is contained in:
Viktor Szakats
2010-10-17 22:58:23 +00:00
parent a7cbf108a1
commit bf03632cc3
8 changed files with 204 additions and 31 deletions

View File

@@ -16,6 +16,29 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-10-18 00:57 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/qtgui/hbqtgui.hbx
+ contrib/hbqt/qtgui/THbQtUI.prg
* contrib/hbqt/qtgui/hbqtgui.hbm
* contrib/hbqt/qtuitools/hbqtuitools.hbm
* contrib/hbqt/qtuitools/hbqtuitools.hbx
- contrib/hbqt/qtuitools/THbQtUI.prg
+ contrib/hbqt/qtuitools/THbQtUILoader.prg
* contrib/hbqt/hbqt_hbmk2_plugin.hbs
+ Added new HbQtUI class (with temp name HbQtUI2) which
is light version of HbQtUI with no ties to qtuitools/uiloader
components.
New class is inheriting from HBQT root class, it
contains minor optimizations and cleanups.
It works, but it's not yet activated.
* Moved Q__TR() to hbqtgui from hbqtuitools.
; TODO: Clear all TOFIX/QUESTION/TODO items in THbQtUI.prg.
F.e. user code like hbide makes quite many direct
manipulations on HbQtUI internal variables. This should
pbly be fixed.
; TODO: Optimize the OnError way of doing things in HbQtUI class.
* Renamed THbQtUI.prg to THbQtUILoader.prg in hbqtuitools.
2010-10-17 23:35 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbxbp/hbxbp.hbc
* contrib/hbide/hbide.hbp

View File

@@ -595,32 +595,32 @@ STATIC FUNCTION hbq_gen_ui_prg( cFile, cFuncName )
AAdd( aLinesPRG, "" )
AAdd( aLinesPRG, "FUNCTION " + cFuncName + "( qParent )" )
AAdd( aLinesPRG, " LOCAL oUI" )
AAdd( aLinesPRG, " LOCAL oWidget" )
AAdd( aLinesPRG, " LOCAL qObj := { => }" )
AAdd( aLinesPRG, " LOCAL oRootWidget" )
AAdd( aLinesPRG, " LOCAL hWidget := { => }" )
AAdd( aLinesPRG, "" )
AAdd( aLinesPRG, " hb_hCaseMatch( qObj, .F. )" )
AAdd( aLinesPRG, " hb_hCaseMatch( hWidget, .F. )" )
AAdd( aLinesPRG, "" )
SWITCH cMCls
CASE "QDialog"
AAdd( aLinesPRG, " oWidget := QDialog( qParent )" )
AAdd( aLinesPRG, " oRootWidget := QDialog( qParent )" )
EXIT
CASE "QWidget"
AAdd( aLinesPRG, " oWidget := QWidget( qParent )" )
AAdd( aLinesPRG, " oRootWidget := QWidget( qParent )" )
EXIT
CASE "QMainWindow"
AAdd( aLinesPRG, " oWidget := QMainWindow( qParent )" )
AAdd( aLinesPRG, " oRootWidget := QMainWindow( qParent )" )
EXIT
ENDSWITCH
AAdd( aLinesPRG, " " )
AAdd( aLinesPRG, " oWidget:setObjectName( " + STRINGIFY( cMNam ) + " )" )
AAdd( aLinesPRG, " oRootWidget:setObjectName( " + STRINGIFY( cMNam ) + " )" )
AAdd( aLinesPRG, " " )
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( cMNam ) ) + " ] := oWidget" )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( cMNam ) ) + " ] := oRootWidget" )
AAdd( aLinesPRG, " " )
FOR EACH item IN aWidgets
IF item:__enumIndex() > 1
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( item[ 2 ] ) ) + " ] := " + StrTran( item[ 4 ], "o[", "qObj[" ) )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( item[ 2 ] ) ) + " ] := " + StrTran( item[ 4 ], "o[", "hWidget[" ) )
ENDIF
NEXT
AAdd( aLinesPRG, "" )
@@ -645,27 +645,27 @@ STATIC FUNCTION hbq_gen_ui_prg( cFile, cFuncName )
IF "setToolTip(" $ cCmd
s := hbq_pullToolTip( cCmd )
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setToolTip( [" + STRIP_SQ( s ) + "] )" )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setToolTip( [" + STRIP_SQ( s ) + "] )" )
ELSEIF "setPlainText(" $ cCmd
s := hbq_pullToolTip( cCmd )
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setPlainText( [" + STRIP_SQ( s ) + "] )" )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setPlainText( [" + STRIP_SQ( s ) + "] )" )
ELSEIF "setStyleSheet(" $ cCmd
s := hbq_pullToolTip( cCmd )
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setStyleSheet( [" + STRIP_SQ( s ) + "] )" )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setStyleSheet( [" + STRIP_SQ( s ) + "] )" )
ELSEIF "setText(" $ cCmd
s := hbq_pullToolTip( cCmd )
IF hbq_pullColumn( cCmd, @n )
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setText( " + hb_ntos( n ) + ", [" + STRIP_SQ( s ) + "] )" )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setText( " + hb_ntos( n ) + ", [" + STRIP_SQ( s ) + "] )" )
ELSE
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setText( [" + STRIP_SQ( s ) + "] )" )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setText( [" + STRIP_SQ( s ) + "] )" )
ENDIF
ELSEIF "setWhatsThis(" $ cCmd
s := hbq_pullToolTip( cCmd )
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setWhatsThis( [" + STRIP_SQ( s ) + "] )" )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:setWhatsThis( [" + STRIP_SQ( s ) + "] )" )
ELSEIF "header()->" $ cCmd
// TODO: how to handle : __qtreeviewitem->header()->setVisible( .F. )
@@ -674,15 +674,19 @@ STATIC FUNCTION hbq_gen_ui_prg( cFile, cFuncName )
// Nothing TO DO
ELSE
AAdd( aLinesPRG, " qObj[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:" + StrTran( cCmd, "o[", "qObj[" ) )
AAdd( aLinesPRG, " hWidget[ " + PAD_30( STRINGIFY( cNam ) ) + " ]:" + StrTran( cCmd, "o[", "hWidget[" ) )
ENDIF
NEXT
AAdd( aLinesPRG, "" )
#if 0
AAdd( aLinesPRG, " oUI := HbQtUI2():new( oRootWidget, hWidget )" )
#else
AAdd( aLinesPRG, " oUI := HbQtUI():new()" )
AAdd( aLinesPRG, " oUI:qObj := qObj" )
AAdd( aLinesPRG, " oUI:oWidget := oWidget" )
AAdd( aLinesPRG, " oUI:pPtr := oWidget:pPtr" )
AAdd( aLinesPRG, " oUI:qObj := hWidget" )
AAdd( aLinesPRG, " oUI:oWidget := oRootWidget" )
AAdd( aLinesPRG, " oUI:pPtr := oRootWidget:pPtr" )
#endif
AAdd( aLinesPRG, "" )
AAdd( aLinesPRG, " RETURN oUI" )
AAdd( aLinesPRG, "" )

View File

@@ -0,0 +1,154 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* THbQtUI class
*
* Copyright 2010 Pritpal Bedi <pritpal@vouchcac.com>
* 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 Parts HbQtUI Class
*
* Pritpal Bedi <pritpal@vouchcac.com>
* 28Jan2010
*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
#include "hbclass.ch"
#include "error.ch"
/*----------------------------------------------------------------------*/
/* TODO: Rename HbQtUI2 to final name after finalizing the code. [vszakats] */
CREATE CLASS HbQtUI2 INHERIT HbQtObjectHandler
VAR oWidget /* TOFIX: User code uses this directly. Then rename this to __oRootWidget and make it PROTECTED. */
VAR qObj INIT { => } /* TOFIX: User code uses this directly. Then rename this to __hWidget and make it PROTECTED. */
METHOD new( oRootWidget, hWidget )
METHOD destroy()
ERROR HANDLER __OnError( ... )
ENDCLASS
/*----------------------------------------------------------------------*/
METHOD HbQtUI2:new( oRootWidget, hWidget )
::oWidget := oRootWidget
::qObj := hWidget
/* QUESTION: Is this needed? */
::pPtr := oRootWidget:pPtr
RETURN Self
/*----------------------------------------------------------------------*/
/* QUESTION: Is this needed? */
METHOD HbQtUI2:destroy()
::oWidget:close()
::oWidget := NIL
RETURN NIL
/*----------------------------------------------------------------------*/
METHOD HbQtUI2:__OnError( ... )
LOCAL cMsg := __GetMessage()
LOCAL oError
IF SubStr( cMsg, 1, 1 ) == "_"
cMsg := SubStr( cMsg, 2 )
ENDIF
IF Left( cMsg, 2 ) == "Q_"
IF SubStr( cMsg, 3 ) $ ::qObj
RETURN ::qObj[ SubStr( cMsg, 3 ) ]
ELSE
oError := ErrorNew()
oError:severity := ES_ERROR
oError:genCode := EG_ARG
oError:subSystem := "HBQT"
oError:subCode := 1001
oError:canRetry := .F.
oError:canDefault := .F.
oError:Args := hb_AParams()
oError:operation := ProcName()
oError:Description := "Control <" + substr( cMsg, 3 ) + "> does not exist"
Eval( ErrorBlock(), oError )
ENDIF
ELSEIF ::oWidget:hasValidPointer() /* QUESTION: Why do we need this? */
RETURN ::oWidget:&cMsg( ... )
ENDIF
RETURN NIL
/*----------------------------------------------------------------------*/
FUNCTION q__tr( p1, p2, p3, p4 )
HB_SYMBOL_UNUSED( p1 )
HB_SYMBOL_UNUSED( p3 )
HB_SYMBOL_UNUSED( p4 )
RETURN p2
/*----------------------------------------------------------------------*/

View File

@@ -23,4 +23,6 @@ hbqt_hbqtableview.h
hbqt_errorsys.prg
THbQtUI.prg
../qtcore/hbqtcore.hbc

View File

@@ -1082,6 +1082,7 @@ DYNAMIC QWIZARDFROMPOINTER
DYNAMIC QWIZARDPAGE
DYNAMIC QWIZARDPAGEFROM
DYNAMIC QWIZARDPAGEFROMPOINTER
DYNAMIC Q__TR
#ifdef __HBEXTERN__HBQTGUI__REQUEST
#uncommand DYNAMIC <fncs,...> => EXTERNAL <fncs>

View File

@@ -727,16 +727,6 @@ STATIC FUNCTION hbq_setObjects( cCmd, aObj_ )
/*----------------------------------------------------------------------*/
FUNCTION q__tr( p1, p2, p3, p4 )
HB_SYMBOL_UNUSED( p1 )
HB_SYMBOL_UNUSED( p3 )
HB_SYMBOL_UNUSED( p4 )
RETURN p2
/*----------------------------------------------------------------------*/
STATIC FUNCTION hbq_pullText( org_, nFrom )
LOCAL s := "", nLen := len( org_ )
LOCAL a_:= { "setText(", "setPlainText(", "setStyleSheet(", "setWhatsThis(" }

View File

@@ -7,6 +7,6 @@
g/filelist.hbm
THbQtUI.prg
THbQtUILoader.prg
../qtgui/hbqtgui.hbc

View File

@@ -33,7 +33,6 @@ DYNAMIC HB_QUILOADER
DYNAMIC QUILOADER
DYNAMIC QUILOADERFROM
DYNAMIC QUILOADERFROMPOINTER
DYNAMIC Q__TR
#ifdef __HBEXTERN__HBQTUITOOLS__REQUEST
#uncommand DYNAMIC <fncs,...> => EXTERNAL <fncs>