From cf7f8010191c06fec02caa734b4627e7c796fd13 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 25 Dec 2009 02:51:33 +0000 Subject: [PATCH] 2009-12-24 18:46 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/ideactions.prg + Provided menu option which sets the codec for current session. It is also provided a slot in the statusbar. * contrib/hbqt/generator/qt45.qtp * contrib/hbqt/hbqt.h * contrib/hbqt/hbqt_garbage.h * contrib/hbqt/qtcore/filelist.mk + contrib/hbqt/qtcore/QSettings.cpp + contrib/hbqt/qtcore/TQSettings.prg + contrib/hbqt/qth/QSettings.qth + Added QSettings() class. * contrib/hbxbp/xbpmenubar.prg ! Fixed an awkward bug. --- harbour/ChangeLog | 18 + harbour/contrib/hbide/hbide.prg | 56 ++- harbour/contrib/hbide/ideactions.prg | 85 ++++- harbour/contrib/hbqt/generator/qt45.qtp | 1 + harbour/contrib/hbqt/hbqt.h | 1 + harbour/contrib/hbqt/hbqt_garbage.h | 2 + harbour/contrib/hbqt/qtcore/QSettings.cpp | 387 +++++++++++++++++++++ harbour/contrib/hbqt/qtcore/TQSettings.prg | 222 ++++++++++++ harbour/contrib/hbqt/qtcore/filelist.mk | 2 + harbour/contrib/hbqt/qth/QSettings.qth | 133 +++++++ harbour/contrib/hbxbp/xbpmenubar.prg | 16 +- 11 files changed, 901 insertions(+), 22 deletions(-) create mode 100644 harbour/contrib/hbqt/qtcore/QSettings.cpp create mode 100644 harbour/contrib/hbqt/qtcore/TQSettings.prg create mode 100644 harbour/contrib/hbqt/qth/QSettings.qth diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 683e7d392b..7709342bce 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,24 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-24 18:46 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.prg + * contrib/hbide/ideactions.prg + + Provided menu option which sets the codec for + current session. It is also provided a slot in the statusbar. + + * contrib/hbqt/generator/qt45.qtp + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_garbage.h + * contrib/hbqt/qtcore/filelist.mk + + contrib/hbqt/qtcore/QSettings.cpp + + contrib/hbqt/qtcore/TQSettings.prg + + contrib/hbqt/qth/QSettings.qth + + Added QSettings() class. + + * contrib/hbxbp/xbpmenubar.prg + ! Fixed an awkward bug. + 2009-12-24 15:56 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt_destruct.cpp + Added prg callable function hbqt_setCodecForCStrings( cCodec ). diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 9f2991bca9..b2fd244ee7 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -248,6 +248,7 @@ CLASS HbIde METHOD buildProjectViaQt() METHOD readProcessInfo() METHOD goto() + METHOD setCodec() ENDCLASS @@ -272,12 +273,10 @@ METHOD HbIde:new( cProjIni ) /*----------------------------------------------------------------------*/ METHOD HbIde:create( cProjIni ) + //LOCAL qSet hbqt_errorsys() - /* It is my mother tongue but do not know how to check - Pritpal */ - HbXbp_SetCodec( "Iscii-Pnj" ) - ::loadConfig( cProjIni ) ::BuildDialog() @@ -321,6 +320,13 @@ METHOD HbIde:create( cProjIni ) ::findReplace( .f. ) + #if 0 + qSet := QSettings():new( "Harbour", "HbIde" ) + IF !qSet:isNull() + ::oDlg:oWidget:restoreState( qSet:value( "state" ) ) + ENDIF + #endif + ::oDlg:Show() ::loadSources() @@ -411,7 +417,7 @@ METHOD HbIde:create( cProjIni ) /*----------------------------------------------------------------------*/ METHOD HbIde:saveConfig() - LOCAL nTab, pTab, n, txt_, qEdit, qHScr, qVScr + LOCAL nTab, pTab, n, txt_, qEdit, qHScr, qVScr, qBArray, qSet LOCAL nTabs := ::qTabWidget:count() txt_:= {} @@ -427,6 +433,14 @@ METHOD HbIde:saveConfig() aadd( txt_, "GotoDialogGeometry = " + ::aIni[ INI_HBIDE, GotoDialogGeometry ] ) aadd( txt_, "PropsDialogGeometry = " + ::aIni[ INI_HBIDE, PropsDialogGeometry ] ) aadd( txt_, "FindDialogGeometry = " + ::aIni[ INI_HBIDE, FindDialogGeometry ] ) + + qSet := QSettings():new( "Harbour", "HbIde" ) + qSet:setValue( "state", ::oDlg:oWidget:saveState() ) + + qBArray := QByteArray() + qBArray:pPtr := ::oDlg:oWidget:saveState() +HB_TRACE( HB_TR_ALWAYS, qBArray:size(), qBArray:constData(), qBArray:isNull(), len( qBArray:constData() ) ) + aadd( txt_, "State = " + qBArray:data_1() ) aadd( txt_, " " ) // Projects @@ -924,6 +938,7 @@ METHOD HbIde:buildEditorTree() ::oDockED := XbpWindow():new( ::oDa ) ::oDockED:oWidget := QDockWidget():new( ::oDlg:oWidget ) + ::oDockED:oWidget:setObjectName( "dockEditorTabs" ) ::oDlg:addChild( ::oDockED ) ::oDockED:oWidget:setFeatures( QDockWidget_DockWidgetClosable + QDockWidget_DockWidgetMovable ) ::oDockED:oWidget:setAllowedAreas( Qt_LeftDockWidgetArea ) @@ -965,6 +980,7 @@ METHOD HbIde:buildProjectTree() ::oDockPT := XbpWindow():new( ::oDa ) ::oDockPT:oWidget := QDockWidget():new( ::oDlg:oWidget ) + ::oDockPT:oWidget:setObjectName( "dockProjectTree" ) ::oDlg:addChild( ::oDockPT ) ::oDockPT:oWidget:setFeatures( QDockWidget_DockWidgetClosable + QDockWidget_DockWidgetMovable ) ::oDockPT:oWidget:setAllowedAreas( Qt_LeftDockWidgetArea ) @@ -1220,6 +1236,7 @@ METHOD HbIde:buildStatusBar() ::oSBar:addItem( "", , , , "Stream" ):oWidget:setMinimumWidth( 20 ) ::oSBar:addItem( "", , , , "Edit" ):oWidget:setMinimumWidth( 20 ) ::oSBar:addItem( "", , , , "Search" ):oWidget:setMinimumWidth( 20 ) + ::oSBar:addItem( "", , , , "Codec" ):oWidget:setMinimumWidth( 20 ) RETURN Self @@ -1238,17 +1255,13 @@ METHOD HbIde:dispEditInfo() s := "Line "+ hb_ntos( ::qCursor:blockNumber()+1 ) + " of " + ; hb_ntos( qDoc:blockCount() ) + "" - ::oSBar:getItem( 3 ):caption := s - - ::oSBar:getItem( 4 ):caption := "Col " + hb_ntos( ::qCursor:columnNumber()+1 ) - - ::oSBar:getItem( 5 ):caption := IIF( qEdit:overwriteMode(), " ", "Ins" ) - - ::oSBar:getItem( 7 ):caption := IIF( qDoc:isModified(), "Modified", " " ) - - ::oSBar:getItem( 9 ):caption := "Stream" + ::oSBar:getItem( 3 ):caption := s + ::oSBar:getItem( 4 ):caption := "Col " + hb_ntos( ::qCursor:columnNumber()+1 ) + ::oSBar:getItem( 5 ):caption := IIF( qEdit:overwriteMode(), " ", "Ins" ) + ::oSBar:getItem( 7 ):caption := IIF( qDoc:isModified(), "Modified", " " ) + ::oSBar:getItem( 9 ):caption := "Stream" ::oSBar:getItem( 10 ):caption := "Edit" - ::oSBar:getItem( 1 ):caption := "Success" + ::oSBar:getItem( 1 ):caption := "Success" ELSE ::oSBar:getItem( 2 ):caption := " " @@ -1260,6 +1273,7 @@ METHOD HbIde:dispEditInfo() ::oSBar:getItem( 8 ):caption := " " ::oSBar:getItem( 9 ):caption := " " ::oSBar:getItem( 10 ):caption := " " + ::oSBar:getItem( 10 ):caption := " " ::oSBar:getItem( 1 ):caption := " " ENDIF @@ -1308,6 +1322,7 @@ METHOD HbIde:buildFuncList() ::oDockR := XbpWindow():new( ::oDa ) ::oDockR:oWidget := QDockWidget():new( ::oDlg:oWidget ) + ::oDockR:oWidget:setObjectName( "dockFuncList" ) ::oDlg:addChild( ::oDockR ) ::oDockR:oWidget:setFeatures( QDockWidget_DockWidgetClosable + QDockWidget_DockWidgetMovable ) ::oDockR:oWidget:setAllowedAreas( Qt_RightDockWidgetArea ) @@ -1440,6 +1455,7 @@ METHOD HbIde:buildCompileResults() ::oDockB := XbpWindow():new( ::oDa ) ::oDockB:oWidget := QDockWidget():new( ::oDlg:oWidget ) + ::oDockB:oWidget:setObjectName( "dockCompileResults" ) ::oDlg:addChild( ::oDockB ) ::oDockB:oWidget:setFeatures( QDockWidget_DockWidgetClosable ) ::oDockB:oWidget:setAllowedAreas( Qt_BottomDockWidgetArea ) @@ -1460,6 +1476,7 @@ METHOD HbIde:buildLinkResults() ::oDockB1 := XbpWindow():new( ::oDa ) ::oDockB1:oWidget := QDockWidget():new( ::oDlg:oWidget ) + ::oDockB1:oWidget:setObjectName( "dockLinkResults" ) ::oDlg:addChild( ::oDockB1 ) ::oDockB1:oWidget:setFeatures( QDockWidget_DockWidgetClosable ) ::oDockB1:oWidget:setAllowedAreas( Qt_BottomDockWidgetArea ) @@ -1480,6 +1497,7 @@ METHOD HbIde:buildOutputResults() ::oDockB2 := XbpWindow():new( ::oDa ) ::oDockB2:oWidget := QDockWidget():new( ::oDlg:oWidget ) + ::oDockB2:oWidget:setObjectName( "dockOutputResults" ) ::oDlg:addChild( ::oDockB2 ) ::oDockB2:oWidget:setFeatures( QDockWidget_DockWidgetClosable ) ::oDockB2:oWidget:setAllowedAreas( Qt_BottomDockWidgetArea ) @@ -2153,7 +2171,7 @@ METHOD HbIde:findReplace( lShow ) ::oFR:signal( "buttonClose" , "clicked()", ; {|| ::aIni[ INI_HBIDE, FindDialogGeometry ] := PosAndSize( ::oFR:oWidget ), ::oFR:hide() } ) - ::oFR:signal( "comboFindWhat" , "currentIndexChanged(text)", {|o,p| o := o, ::oSBar:getItem( 11 ):caption := "FIND: " + p } ) + ::oFR:signal( "comboFindWhat", "currentIndexChanged(text)", {|o,p| o := o, ::oSBar:getItem( 11 ):caption := "FIND: " + p } ) ::oFR:signal( "checkListOnly", "stateChanged(int)", {|o,p| o := o, ; ::oFR:qObj[ "comboReplaceWith" ]:setEnabled( p == 0 ), ; @@ -2208,3 +2226,11 @@ METHOD HbIde:goto() /*----------------------------------------------------------------------*/ +METHOD HbIde:setCodec( cCodec ) + + HbXbp_SetCodec( cCodec ) + ::oSBar:getItem( 12 ):caption := cCodec + + RETURN Self + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/ideactions.prg b/harbour/contrib/hbide/ideactions.prg index 07cdcb5f47..e95d252078 100644 --- a/harbour/contrib/hbide/ideactions.prg +++ b/harbour/contrib/hbide/ideactions.prg @@ -134,7 +134,7 @@ FUNCTION buildToolBar( oWnd, oIde ) /*----------------------------------------------------------------------*/ FUNCTION buildMainMenu( oWnd, oIde ) - LOCAL oMenuBar, oSubMenu + LOCAL oMenuBar, oSubMenu, oSub1 oMenuBar := oWnd:MenuBar() @@ -159,7 +159,90 @@ FUNCTION buildMainMenu( oWnd, oIde ) oSubMenu:addItem( { "Save and Create PPO Output" , {|| oIde:executeAction( "SavePPO" ) } } ) MenuAddSep( oSubMenu ) oSubMenu:addItem( { "Project Properties" , {|| oIde:executeAction( "Properties" ) } } ) + oMenuBar:addItem( { oSubMenu, NIL } ) + oSubMenu := XbpMenu():new( oMenuBar ):create() + oSubMenu:title := "~CodePage" + oSubMenu:addItem( { "Apple Roman " , {|| oIde:setCodec( "Apple Roman" ) } } ) + oSubMenu:addItem( { "Big5 " , {|| oIde:setCodec( "Big5" ) } } ) + oSubMenu:addItem( { "Big5-HKSCS " , {|| oIde:setCodec( "Big5-HKSCS" ) } } ) + oSubMenu:addItem( { "CP949 " , {|| oIde:setCodec( "CP949" ) } } ) + oSubMenu:addItem( { "EUC-JP " , {|| oIde:setCodec( "EUC-JP" ) } } ) + oSubMenu:addItem( { "EUC-KR " , {|| oIde:setCodec( "EUC-KR" ) } } ) + oSubMenu:addItem( { "GB18030-0 " , {|| oIde:setCodec( "GB18030-0" ) } } ) + oSubMenu:addItem( { "IBM 850 " , {|| oIde:setCodec( "IBM 850" ) } } ) + oSubMenu:addItem( { "IBM 866 " , {|| oIde:setCodec( "IBM 866" ) } } ) + oSubMenu:addItem( { "IBM 874 " , {|| oIde:setCodec( "IBM 874" ) } } ) + oSubMenu:addItem( { "ISO 2022-JP " , {|| oIde:setCodec( "ISO 2022-JP" ) } } ) + + oSub1 := XbpMenu():new( oSubMenu ):create() + oSub1:title := "ISO 8859-1 to 10" + oSub1:addItem( { "-1" , {|| oIde:setCodec( "ISO 8859-1" ) } } ) + oSub1:addItem( { "-2" , {|| oIde:setCodec( "ISO 8859-2" ) } } ) + oSub1:addItem( { "-3" , {|| oIde:setCodec( "ISO 8859-3" ) } } ) + oSub1:addItem( { "-4" , {|| oIde:setCodec( "ISO 8859-4" ) } } ) + oSub1:addItem( { "-5" , {|| oIde:setCodec( "ISO 8859-5" ) } } ) + oSub1:addItem( { "-6" , {|| oIde:setCodec( "ISO 8859-6" ) } } ) + oSub1:addItem( { "-7" , {|| oIde:setCodec( "ISO 8859-7" ) } } ) + oSub1:addItem( { "-8" , {|| oIde:setCodec( "ISO 8859-8" ) } } ) + oSub1:addItem( { "-9" , {|| oIde:setCodec( "ISO 8859-9" ) } } ) + oSub1:addItem( { "-10" , {|| oIde:setCodec( "ISO 8859-10" ) } } ) + oSubMenu:addItem( { oSub1, NIL } ) + + oSub1 := XbpMenu():new( oSubMenu ):create() + oSub1:title := "ISO 8859-13 to 16" + oSub1:addItem( { "-13" , {|| oIde:setCodec( "ISO 8859-13" ) } } ) + oSub1:addItem( { "-14" , {|| oIde:setCodec( "ISO 8859-14" ) } } ) + oSub1:addItem( { "-15" , {|| oIde:setCodec( "ISO 8859-15" ) } } ) + oSub1:addItem( { "-16" , {|| oIde:setCodec( "ISO 8859-16" ) } } ) + oSubMenu:addItem( { oSub1, NIL } ) + + //oSubMenu:addItem( { "Iscii " , {|| oIde:setCodec( "Iscii" ) } } ) //-Bng, Dev, Gjr, Knd, Mlm, Ori, Pnj, Tlg, Tml + oSub1 := XbpMenu():new( oSubMenu ):create() + oSub1:title := "Iscii" + oSub1:addItem( { "-Bng" , {|| oIde:setCodec( "Iscii-Bng" ) } } ) + oSub1:addItem( { "-Dev" , {|| oIde:setCodec( "Iscii-Dev" ) } } ) + oSub1:addItem( { "-Gjr" , {|| oIde:setCodec( "Iscii-Gjr" ) } } ) + oSub1:addItem( { "-Knd" , {|| oIde:setCodec( "Iscii-Knd" ) } } ) + oSub1:addItem( { "-Mlm" , {|| oIde:setCodec( "Iscii-Mlm" ) } } ) + oSub1:addItem( { "-Ori" , {|| oIde:setCodec( "Iscii-Ori" ) } } ) + oSub1:addItem( { "-Pnj" , {|| oIde:setCodec( "Iscii-Pnj" ) } } ) + oSub1:addItem( { "-Tlg" , {|| oIde:setCodec( "Iscii-Tlg" ) } } ) + oSub1:addItem( { "-Tml" , {|| oIde:setCodec( "Iscii-Tml" ) } } ) + oSubMenu:addItem( { oSub1, NIL } ) + + oSubMenu:addItem( { "JIS X 0201 " , {|| oIde:setCodec( "JIS X 0201" ) } } ) + oSubMenu:addItem( { "JIS X 0208 " , {|| oIde:setCodec( "JIS X 0208" ) } } ) + oSubMenu:addItem( { "KOI8-R " , {|| oIde:setCodec( "KOI8-R" ) } } ) + oSubMenu:addItem( { "KOI8-U " , {|| oIde:setCodec( "KOI8-U" ) } } ) + oSubMenu:addItem( { "MuleLao-1 " , {|| oIde:setCodec( "MuleLao-1" ) } } ) + oSubMenu:addItem( { "ROMAN8 " , {|| oIde:setCodec( "ROMAN8" ) } } ) + oSubMenu:addItem( { "Shift-JIS " , {|| oIde:setCodec( "Shift-JIS" ) } } ) + oSubMenu:addItem( { "TIS-620 " , {|| oIde:setCodec( "TIS-620" ) } } ) + oSubMenu:addItem( { "TSCII " , {|| oIde:setCodec( "TSCII" ) } } ) + oSubMenu:addItem( { "UTF-8 " , {|| oIde:setCodec( "UTF-8" ) } } ) + oSubMenu:addItem( { "UTF-16 " , {|| oIde:setCodec( "UTF-16" ) } } ) + oSubMenu:addItem( { "UTF-16BE " , {|| oIde:setCodec( "UTF-16BE" ) } } ) + oSubMenu:addItem( { "UTF-16LE " , {|| oIde:setCodec( "UTF-16LE" ) } } ) + oSubMenu:addItem( { "UTF-32 " , {|| oIde:setCodec( "UTF-32" ) } } ) + oSubMenu:addItem( { "UTF-32BE " , {|| oIde:setCodec( "UTF-32BE" ) } } ) + oSubMenu:addItem( { "UTF-32LE " , {|| oIde:setCodec( "UTF-32LE" ) } } ) + + //oSubMenu:addItem( { "Windows " , {|| oIde:setCodec( "Windows" ) } } ) //-1250 to 1258 + oSub1 := XbpMenu():new( oSubMenu ):create() + oSub1:title := "Windows-1250 to 1258" + oSub1:addItem( { "-1250" , {|| oIde:setCodec( "Windows-1250" ) } } ) + oSub1:addItem( { "-1251" , {|| oIde:setCodec( "Windows-1251" ) } } ) + oSub1:addItem( { "-1252" , {|| oIde:setCodec( "Windows-1252" ) } } ) + oSub1:addItem( { "-1253" , {|| oIde:setCodec( "Windows-1253" ) } } ) + oSub1:addItem( { "-1254" , {|| oIde:setCodec( "Windows-1254" ) } } ) + oSub1:addItem( { "-1255" , {|| oIde:setCodec( "Windows-1255" ) } } ) + oSub1:addItem( { "-1256" , {|| oIde:setCodec( "Windows-1256" ) } } ) + oSub1:addItem( { "-1257" , {|| oIde:setCodec( "Windows-1257" ) } } ) + oSub1:addItem( { "-1258" , {|| oIde:setCodec( "Windows-1258" ) } } ) + oSubMenu:addItem( { oSub1, NIL } ) + + oSubMenu:addItem( { "WINSAMI2 " , {|| oIde:setCodec( "WINSAMI2" ) } } ) oMenuBar:addItem( { oSubMenu, NIL } ) Return Nil diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index bdf9c8ff9f..72400d3ef1 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -168,6 +168,7 @@ QResource.qth QScrollArea.qth QScrollBar.qth QSessionManager.qth +QSettings.qth QSignalMapper.qth QSize.qth QSizeF.qth diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index d4a2517cc1..b5ee570b8b 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -251,6 +251,7 @@ extern void * hbqt_pPtrFromObj( int iParam ); #define hbqt_par_QScrollArea( n ) ( ( QScrollArea * ) hbqt_gcpointer( n ) ) #define hbqt_par_QScrollBar( n ) ( ( QScrollBar * ) hbqt_gcpointer( n ) ) #define hbqt_par_QSessionManager( n ) ( ( QSessionManager * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QSettings( n ) ( ( QSettings * ) hbqt_gcpointer( n ) ) #define hbqt_par_QSignalMapper( n ) ( ( QSignalMapper * ) hbqt_gcpointer( n ) ) #define hbqt_par_QSize( n ) ( ( QSize * ) hbqt_gcpointer( n ) ) #define hbqt_par_QSizeF( n ) ( ( QSizeF * ) hbqt_gcpointer( n ) ) diff --git a/harbour/contrib/hbqt/hbqt_garbage.h b/harbour/contrib/hbqt/hbqt_garbage.h index 104ae3215d..20bb15281a 100644 --- a/harbour/contrib/hbqt/hbqt_garbage.h +++ b/harbour/contrib/hbqt/hbqt_garbage.h @@ -162,6 +162,7 @@ extern QT_G_FUNC( hbqt_gcRelease_QResource ); extern QT_G_FUNC( hbqt_gcRelease_QScrollArea ); extern QT_G_FUNC( hbqt_gcRelease_QScrollBar ); extern QT_G_FUNC( hbqt_gcRelease_QSessionManager ); +extern QT_G_FUNC( hbqt_gcRelease_QSettings ); extern QT_G_FUNC( hbqt_gcRelease_QSignalMapper ); extern QT_G_FUNC( hbqt_gcRelease_QSize ); extern QT_G_FUNC( hbqt_gcRelease_QSizeF ); @@ -432,6 +433,7 @@ extern void * hbqt_gcAllocate_QResource( void * pObj ); extern void * hbqt_gcAllocate_QScrollArea( void * pObj ); extern void * hbqt_gcAllocate_QScrollBar( void * pObj ); extern void * hbqt_gcAllocate_QSessionManager( void * pObj ); +extern void * hbqt_gcAllocate_QSettings( void * pObj ); extern void * hbqt_gcAllocate_QSignalMapper( void * pObj ); extern void * hbqt_gcAllocate_QSize( void * pObj ); extern void * hbqt_gcAllocate_QSizeF( void * pObj ); diff --git a/harbour/contrib/hbqt/qtcore/QSettings.cpp b/harbour/contrib/hbqt/qtcore/QSettings.cpp new file mode 100644 index 0000000000..646a484db3 --- /dev/null +++ b/harbour/contrib/hbqt/qtcore/QSettings.cpp @@ -0,0 +1,387 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.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. + * + */ +/*----------------------------------------------------------------------*/ + +#include "hbapi.h" +#include "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +/* + * enum Format { NativeFormat, IniFormat, InvalidFormat } + * enum Scope { UserScope, SystemScope } + * enum Status { NoError, AccessError, FormatError } + */ + +#include + +#include +#include + +/* + * QSettings ( const QString & organization, const QString & application = QString(), QObject * parent = 0 ) + * QSettings ( Scope scope, const QString & organization, const QString & application = QString(), QObject * parent = * 0 ) + * QSettings ( Format format, Scope scope, const QString & organization, const QString & application = QString(), * QObject * parent = 0 ) + * QSettings ( const QString & fileName, Format format, QObject * parent = 0 ) + * QSettings ( QObject * parent = 0 ) + * ~QSettings () + */ + +typedef struct +{ + void * ph; + QT_G_FUNC_PTR func; + QPointer< QSettings > pq; +} QGC_POINTER_QSettings; + +QT_G_FUNC( hbqt_gcRelease_QSettings ) +{ + QGC_POINTER_QSettings * p = ( QGC_POINTER_QSettings * ) Cargo; + + HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSettings p=%p", p)); + HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSettings ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) + { + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) + { + switch( hbqt_get_object_release_method() ) + { + case HBQT_RELEASE_WITH_DELETE: + delete ( ( QSettings * ) p->ph ); + break; + case HBQT_RELEASE_WITH_DESTRUTOR: + ( ( QSettings * ) p->ph )->~QSettings(); + break; + case HBQT_RELEASE_WITH_DELETE_LATER: + ( ( QSettings * ) p->ph )->deleteLater(); + break; + } + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSettings Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSettings Object Name Missing!" ) ); + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSettings Object Already deleted!" ) ); + } +} + +void * hbqt_gcAllocate_QSettings( void * pObj ) +{ + QGC_POINTER_QSettings * p = ( QGC_POINTER_QSettings * ) hb_gcAllocate( sizeof( QGC_POINTER_QSettings ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->func = hbqt_gcRelease_QSettings; + new( & p->pq ) QPointer< QSettings >( ( QSettings * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " new_QSettings %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + return( p ); +} + +HB_FUNC( QT_QSETTINGS ) +{ + void * pObj = NULL; + + if( hb_pcount() >= 2 && HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) ) + { + pObj = new QSettings( hbqt_par_QString( 1 ), hbqt_par_QString( 2 ), 0 ) ; + } + else + { + pObj = new QSettings() ; + } + + hb_retptrGC( hbqt_gcAllocate_QSettings( pObj ) ); +} +/* + * QStringList allKeys () const + */ +HB_FUNC( QT_QSETTINGS_ALLKEYS ) +{ + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->allKeys() ) ) ); +} + +/* + * QString applicationName () const + */ +HB_FUNC( QT_QSETTINGS_APPLICATIONNAME ) +{ + hb_retc( hbqt_par_QSettings( 1 )->applicationName().toAscii().data() ); +} + +/* + * void beginGroup ( const QString & prefix ) + */ +HB_FUNC( QT_QSETTINGS_BEGINGROUP ) +{ + hbqt_par_QSettings( 1 )->beginGroup( hbqt_par_QString( 2 ) ); +} + +/* + * int beginReadArray ( const QString & prefix ) + */ +HB_FUNC( QT_QSETTINGS_BEGINREADARRAY ) +{ + hb_retni( hbqt_par_QSettings( 1 )->beginReadArray( hbqt_par_QString( 2 ) ) ); +} + +/* + * void beginWriteArray ( const QString & prefix, int size = -1 ) + */ +HB_FUNC( QT_QSETTINGS_BEGINWRITEARRAY ) +{ + hbqt_par_QSettings( 1 )->beginWriteArray( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ); +} + +/* + * QStringList childGroups () const + */ +HB_FUNC( QT_QSETTINGS_CHILDGROUPS ) +{ + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->childGroups() ) ) ); +} + +/* + * QStringList childKeys () const + */ +HB_FUNC( QT_QSETTINGS_CHILDKEYS ) +{ + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->childKeys() ) ) ); +} + +/* + * void clear () + */ +HB_FUNC( QT_QSETTINGS_CLEAR ) +{ + hbqt_par_QSettings( 1 )->clear(); +} + +/* + * bool contains ( const QString & key ) const + */ +HB_FUNC( QT_QSETTINGS_CONTAINS ) +{ + hb_retl( hbqt_par_QSettings( 1 )->contains( hbqt_par_QString( 2 ) ) ); +} + +/* + * void endArray () + */ +HB_FUNC( QT_QSETTINGS_ENDARRAY ) +{ + hbqt_par_QSettings( 1 )->endArray(); +} + +/* + * void endGroup () + */ +HB_FUNC( QT_QSETTINGS_ENDGROUP ) +{ + hbqt_par_QSettings( 1 )->endGroup(); +} + +/* + * bool fallbacksEnabled () const + */ +HB_FUNC( QT_QSETTINGS_FALLBACKSENABLED ) +{ + hb_retl( hbqt_par_QSettings( 1 )->fallbacksEnabled() ); +} + +/* + * QString fileName () const + */ +HB_FUNC( QT_QSETTINGS_FILENAME ) +{ + hb_retc( hbqt_par_QSettings( 1 )->fileName().toAscii().data() ); +} + +/* + * Format format () const + */ +HB_FUNC( QT_QSETTINGS_FORMAT ) +{ + hb_retni( ( QSettings::Format ) hbqt_par_QSettings( 1 )->format() ); +} + +/* + * QString group () const + */ +HB_FUNC( QT_QSETTINGS_GROUP ) +{ + hb_retc( hbqt_par_QSettings( 1 )->group().toAscii().data() ); +} + +/* + * QTextCodec * iniCodec () const + */ +HB_FUNC( QT_QSETTINGS_INICODEC ) +{ + hb_retptr( ( QTextCodec* ) hbqt_par_QSettings( 1 )->iniCodec() ); +} + +/* + * bool isWritable () const + */ +HB_FUNC( QT_QSETTINGS_ISWRITABLE ) +{ + hb_retl( hbqt_par_QSettings( 1 )->isWritable() ); +} + +/* + * QString organizationName () const + */ +HB_FUNC( QT_QSETTINGS_ORGANIZATIONNAME ) +{ + hb_retc( hbqt_par_QSettings( 1 )->organizationName().toAscii().data() ); +} + +/* + * void remove ( const QString & key ) + */ +HB_FUNC( QT_QSETTINGS_REMOVE ) +{ + hbqt_par_QSettings( 1 )->remove( hbqt_par_QString( 2 ) ); +} + +/* + * Scope scope () const + */ +HB_FUNC( QT_QSETTINGS_SCOPE ) +{ + hb_retni( ( QSettings::Scope ) hbqt_par_QSettings( 1 )->scope() ); +} + +/* + * void setArrayIndex ( int i ) + */ +HB_FUNC( QT_QSETTINGS_SETARRAYINDEX ) +{ + hbqt_par_QSettings( 1 )->setArrayIndex( hb_parni( 2 ) ); +} + +/* + * void setFallbacksEnabled ( bool b ) + */ +HB_FUNC( QT_QSETTINGS_SETFALLBACKSENABLED ) +{ + hbqt_par_QSettings( 1 )->setFallbacksEnabled( hb_parl( 2 ) ); +} + +/* + * void setIniCodec ( QTextCodec * codec ) + */ +HB_FUNC( QT_QSETTINGS_SETINICODEC ) +{ + hbqt_par_QSettings( 1 )->setIniCodec( hbqt_par_QTextCodec( 2 ) ); +} + +/* + * void setIniCodec ( const char * codecName ) + */ +HB_FUNC( QT_QSETTINGS_SETINICODEC_1 ) +{ + hbqt_par_QSettings( 1 )->setIniCodec( hbqt_par_char( 2 ) ); +} + +/* + * void setValue ( const QString & key, const QVariant & value ) + */ +HB_FUNC( QT_QSETTINGS_SETVALUE ) +{ + hbqt_par_QSettings( 1 )->setValue( hbqt_par_QString( 2 ), *hbqt_par_QVariant( 3 ) ); +} + +/* + * Status status () const + */ +HB_FUNC( QT_QSETTINGS_STATUS ) +{ + hb_retni( ( QSettings::Status ) hbqt_par_QSettings( 1 )->status() ); +} + +/* + * void sync () + */ +HB_FUNC( QT_QSETTINGS_SYNC ) +{ + hbqt_par_QSettings( 1 )->sync(); +} + +/* + * QVariant value ( const QString & key, const QVariant & defaultValue = QVariant() ) const + */ +HB_FUNC( QT_QSETTINGS_VALUE ) +{ + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QSettings( 1 )->value( hbqt_par_QString( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QVariant( 3 ) : QVariant() ) ) ) ) ); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtcore/TQSettings.prg b/harbour/contrib/hbqt/qtcore/TQSettings.prg new file mode 100644 index 0000000000..df2724e22e --- /dev/null +++ b/harbour/contrib/hbqt/qtcore/TQSettings.prg @@ -0,0 +1,222 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.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. + * + */ +/*----------------------------------------------------------------------*/ + + +#include "hbclass.ch" + + +CREATE CLASS QSettings INHERIT HbQtObjectHandler, QObject + + METHOD new() + + METHOD allKeys() + METHOD applicationName() + METHOD beginGroup( cPrefix ) + METHOD beginReadArray( cPrefix ) + METHOD beginWriteArray( cPrefix, nSize ) + METHOD childGroups() + METHOD childKeys() + METHOD clear() + METHOD contains( cKey ) + METHOD endArray() + METHOD endGroup() + METHOD fallbacksEnabled() + METHOD fileName() + METHOD format() + METHOD group() + METHOD iniCodec() + METHOD isWritable() + METHOD organizationName() + METHOD remove( cKey ) + METHOD scope() + METHOD setArrayIndex( nI ) + METHOD setFallbacksEnabled( lB ) + METHOD setIniCodec( pCodec ) + METHOD setIniCodec_1( pCodecName ) + METHOD setValue( cKey, pValue ) + METHOD status() + METHOD sync() + METHOD value( cKey, pDefaultValue ) + + ENDCLASS + + +METHOD QSettings:new( ... ) + LOCAL p + FOR EACH p IN { ... } + p := hbqt_ptr( p ) + hb_pvalue( p:__enumIndex(), p ) + NEXT + ::pPtr := Qt_QSettings( ... ) + RETURN Self + + +METHOD QSettings:allKeys() + RETURN Qt_QSettings_allKeys( ::pPtr ) + + +METHOD QSettings:applicationName() + RETURN Qt_QSettings_applicationName( ::pPtr ) + + +METHOD QSettings:beginGroup( cPrefix ) + RETURN Qt_QSettings_beginGroup( ::pPtr, cPrefix ) + + +METHOD QSettings:beginReadArray( cPrefix ) + RETURN Qt_QSettings_beginReadArray( ::pPtr, cPrefix ) + + +METHOD QSettings:beginWriteArray( cPrefix, nSize ) + RETURN Qt_QSettings_beginWriteArray( ::pPtr, cPrefix, nSize ) + + +METHOD QSettings:childGroups() + RETURN Qt_QSettings_childGroups( ::pPtr ) + + +METHOD QSettings:childKeys() + RETURN Qt_QSettings_childKeys( ::pPtr ) + + +METHOD QSettings:clear() + RETURN Qt_QSettings_clear( ::pPtr ) + + +METHOD QSettings:contains( cKey ) + RETURN Qt_QSettings_contains( ::pPtr, cKey ) + + +METHOD QSettings:endArray() + RETURN Qt_QSettings_endArray( ::pPtr ) + + +METHOD QSettings:endGroup() + RETURN Qt_QSettings_endGroup( ::pPtr ) + + +METHOD QSettings:fallbacksEnabled() + RETURN Qt_QSettings_fallbacksEnabled( ::pPtr ) + + +METHOD QSettings:fileName() + RETURN Qt_QSettings_fileName( ::pPtr ) + + +METHOD QSettings:format() + RETURN Qt_QSettings_format( ::pPtr ) + + +METHOD QSettings:group() + RETURN Qt_QSettings_group( ::pPtr ) + + +METHOD QSettings:iniCodec() + RETURN Qt_QSettings_iniCodec( ::pPtr ) + + +METHOD QSettings:isWritable() + RETURN Qt_QSettings_isWritable( ::pPtr ) + + +METHOD QSettings:organizationName() + RETURN Qt_QSettings_organizationName( ::pPtr ) + + +METHOD QSettings:remove( cKey ) + RETURN Qt_QSettings_remove( ::pPtr, cKey ) + + +METHOD QSettings:scope() + RETURN Qt_QSettings_scope( ::pPtr ) + + +METHOD QSettings:setArrayIndex( nI ) + RETURN Qt_QSettings_setArrayIndex( ::pPtr, nI ) + + +METHOD QSettings:setFallbacksEnabled( lB ) + RETURN Qt_QSettings_setFallbacksEnabled( ::pPtr, lB ) + + +METHOD QSettings:setIniCodec( pCodec ) + RETURN Qt_QSettings_setIniCodec( ::pPtr, hbqt_ptr( pCodec ) ) + + +METHOD QSettings:setIniCodec_1( pCodecName ) + RETURN Qt_QSettings_setIniCodec_1( ::pPtr, hbqt_ptr( pCodecName ) ) + + +METHOD QSettings:setValue( cKey, pValue ) + RETURN Qt_QSettings_setValue( ::pPtr, cKey, hbqt_ptr( pValue ) ) + + +METHOD QSettings:status() + RETURN Qt_QSettings_status( ::pPtr ) + + +METHOD QSettings:sync() + RETURN Qt_QSettings_sync( ::pPtr ) + + +METHOD QSettings:value( cKey, pDefaultValue ) + RETURN Qt_QSettings_value( ::pPtr, cKey, hbqt_ptr( pDefaultValue ) ) + diff --git a/harbour/contrib/hbqt/qtcore/filelist.mk b/harbour/contrib/hbqt/qtcore/filelist.mk index cb97ec62f7..5d150c0bc0 100644 --- a/harbour/contrib/hbqt/qtcore/filelist.mk +++ b/harbour/contrib/hbqt/qtcore/filelist.mk @@ -40,6 +40,7 @@ CPP_SOURCES := \ QRectF.cpp \ QRegExp.cpp \ QResource.cpp \ + QSettings.cpp \ QSignalMapper.cpp \ QSize.cpp \ QSizeF.cpp \ @@ -91,6 +92,7 @@ PRG_SOURCES := \ TQRectF.prg \ TQRegExp.prg \ TQResource.prg \ + TQSettings.prg \ TQSignalMapper.prg \ TQSize.prg \ TQSizeF.prg \ diff --git a/harbour/contrib/hbqt/qth/QSettings.qth b/harbour/contrib/hbqt/qth/QSettings.qth new file mode 100644 index 0000000000..b4c9f2dd9f --- /dev/null +++ b/harbour/contrib/hbqt/qth/QSettings.qth @@ -0,0 +1,133 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * Copyright 2009 Pritpal Bedi + * www - http://www.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. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +Inherits = QObject +Type = Core +New = + + + +#include +#include + +/* + * QSettings ( const QString & organization, const QString & application = QString(), QObject * parent = 0 ) + * QSettings ( Scope scope, const QString & organization, const QString & application = QString(), QObject * parent = * 0 ) + * QSettings ( Format format, Scope scope, const QString & organization, const QString & application = QString(), * QObject * parent = 0 ) + * QSettings ( const QString & fileName, Format format, QObject * parent = 0 ) + * QSettings ( QObject * parent = 0 ) + * ~QSettings () + */ +HB_FUNC( QT_QSETTINGS ) +{ + if( hb_pcount() >= 2 && HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) ) + { + hb_retptr( new QSettings( hbqt_par_QString( 1 ), hbqt_par_QString( 2 ), 0 ) ); + } + else + { + hb_retptr( new QSettings() ); + } +} + + + +enum Format { NativeFormat, IniFormat, InvalidFormat } +enum Scope { UserScope, SystemScope } +enum Status { NoError, AccessError, FormatError } + + + +QStringList allKeys () const +QString applicationName () const +void beginGroup ( const QString & prefix ) +int beginReadArray ( const QString & prefix ) +void beginWriteArray ( const QString & prefix, int size = -1 ) +QStringList childGroups () const +QStringList childKeys () const +void clear () +bool contains ( const QString & key ) const +void endArray () +void endGroup () +bool fallbacksEnabled () const +QString fileName () const +Format format () const +QString group () const +QTextCodec * iniCodec () const +bool isWritable () const +QString organizationName () const +void remove ( const QString & key ) +Scope scope () const +void setArrayIndex ( int i ) +void setFallbacksEnabled ( bool b ) +void setIniCodec ( QTextCodec * codec ) +void setIniCodec ( const char * codecName ) +void setValue ( const QString & key, const QVariant & value ) +Status status () const +void sync () +QVariant value ( const QString & key, const QVariant & defaultValue = QVariant() ) const + + + + + + + + + + + diff --git a/harbour/contrib/hbxbp/xbpmenubar.prg b/harbour/contrib/hbxbp/xbpmenubar.prg index 26e0a2e1a4..7d91253960 100644 --- a/harbour/contrib/hbxbp/xbpmenubar.prg +++ b/harbour/contrib/hbxbp/xbpmenubar.prg @@ -336,8 +336,8 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos ) oAction:setShortcut( oKey ) ENDIF - ::Connect( oAction:pPtr, "triggered(bool)", {|| ::exeBlock( nMenuItemID ) } ) - ::Connect( oAction:pPtr, "hovered()" , {|| ::exeHovered( nMenuItemID ) } ) + ::Connect( oAction, "triggered(bool)", {|| ::exeBlock( nMenuItemID ) } ) + ::Connect( oAction, "hovered()" , {|| ::exeHovered( nMenuItemID ) } ) DO CASE CASE nAttrb == XBPMENUBAR_MIA_CHECKED @@ -474,11 +474,15 @@ METHOD xbpMenuBar:exeBlock( nMenuItemID ) /*----------------------------------------------------------------------*/ METHOD xbpMenuBar:exeHovered( nMenuItemID ) - LOCAL nIndex := ascan( ::aMenuItems, {|e_| e_[ 2 ] == nMenuItemID } ) + LOCAL nIndex - IF nIndex > 0 - IF hb_isBlock( ::sl_itemMarked ) - eval( ::sl_itemMarked, nIndex, NIL, Self ) + IF !empty( nMenuItemID ) + nIndex := ascan( ::aMenuItems, {|e_| iif( hb_isNumeric( e_[ 2 ] ), e_[ 2 ] == nMenuItemID, .f. ) } ) + + IF nIndex > 0 + IF hb_isBlock( ::sl_itemMarked ) + eval( ::sl_itemMarked, nIndex, NIL, Self ) + ENDIF ENDIF ENDIF RETURN nil