diff --git a/ChangeLog.txt b/ChangeLog.txt
index 7a28e577ed..eb3715eff5 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -10,18 +10,36 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
+2013-04-30 02:53 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
+ * contrib/gtqtc/gtqtc1.cpp
+ ! reverted HB_GTI_DISPIMAGE cords
+ ! keep maximized and fullscreen internal flags synced with QT window
+ ! return HB_TRUE from SETMODE() method.
+ ! updated font selection for better size approximation
+ ! accept window size reported by QT in fullscreen and maximized modes
+ ! set size increment steeps separately for ROWS and FONT resize modes
+ ! respect resize step setting minimum window size - it fixes infinite
+ resize loop in some WM
+ % strip repeated HB_K_RESIZE keys
+
+ * README.md
+ * contrib/gtqtc/gtqtc.hbc
+ * contrib/gtqtc/hbmk2_qtmoc.hb
+ * synced with Viktor's patches for QT
+ ; Pritpal, please verify if it works with QT5
+
2013-04-29 16:17 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* ChangeLog.txt
! Fixed: BOM troubled by wrong editor, now with Notepad++
and proper settings. I am unable to change Przemek's name
changed in previous commit, rather unable to understand
what should be changed.
-
+
2013-04-29 12:51 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/gtqtc/gtqtc.hbc
* contrib/gtqtc/hbmk2_qtmoc.hb
+ Prepared to be compiled also with Qt version 5.0 onwards.
-
+
2013-04-29 01:15 UTC+0200 Tamas TEVESZ (ice extreme.hu)
* doc/en/memo.txt
! Fix pastos in MemoWrit()/hb_MemoWrit() argument description
diff --git a/README.md b/README.md
index 9ee8988ff5..701020bbdd 100644
--- a/README.md
+++ b/README.md
@@ -410,7 +410,7 @@ You can fine-tune the build with these options:
$ package/mpkg_rpm_wce.sh
-## Binary .zip & .exe on Windows for all targets (except Linux)
+## Binary .zip and .exe on Windows for all targets (except Linux)
$ set HB_DIR_NSIS=%ProgramFiles%\NSIS\
$ set HB_DIR_ZIP=C:\info-zip\
@@ -427,7 +427,7 @@ See: [How to Build](#how-to-build)
Then run build as usual with `clean install` options.
See: [How to Build](#how-to-build)
-## Unified .7z & .exe installer for Windows
+## Unified .7z and .exe installer for Windows
$ package\winuni\mpkg_win_uni.bat
@@ -492,6 +492,7 @@ the build. Make sure to adjust them to your own directories:
HB_WITH_PCRE=C:\pcre (defaults to locally hosted version if not found)
HB_WITH_PGSQL=C:\pgsql\include
HB_WITH_PNG=C:\libpng (defaults to locally hosted version if not found)
+ HB_WITH_QT=C:\Qt\include (version 4.5.0 or upper is required)
HB_WITH_SLANG= (on *nix systems)
HB_WITH_SQLITE3=C:\sqlite3 (defaults to locally hosted version if not found)
HB_WITH_TIFF=C:\libtiff (defaults to locally hosted version if not found)
@@ -508,6 +509,13 @@ locally hosted copy (inside Harbour source repository) of these packages,
where applicable. `nolocal` will explicitly disable using locally hosted
copy.
+You can override autodetection of QT 'moc' tool by using HB_QTPATH and
+optionally HB_QTPOSTFIX envvars. This may only be necessary on some *nix
+systems. F.e.:
+
+ HB_QTPATH=/opt/qt5/bin/
+ HB_QTPOSTFIX=
+
Certain contribs can be instructed – when using .hbc files – to
link against static build of their 3rd party lib dependencies (for
advanced users only):
@@ -518,19 +526,19 @@ advanced users only):
> NOTES:
>
-> * You need to use native path format to your shell/OS.
-> * Spaces in directory names aren't currently supported.
-> You *can* use 8.3 name alias on Windows platform, though.
-> * Don't put directory names inside double quotes.
-> * Use absolute paths.
+> * you need to use native path format to your shell/OS
+> * spaces in directory names aren't currently supported
+> (you *can* use 8.3 name alias on Windows platform, though)
+> * don't put directory names inside double quotes
+> * use absolute paths
## Darwin (OS X)
1. Install [Homebrew](http://mxcl.github.com/homebrew/)
2. Install packages:
- $ brew install pcre slang cairo freeimage libgd mysql postgresql
- $ brew install upx uncrustify
+ $ brew install pcre slang cairo freeimage libgd mysql postgresql qt5
+ $ brew install upx uncrustify ack optipng jpegoptim
## Linux (generic)
@@ -570,6 +578,7 @@ You'll need these packages to compile certain contribs and optional Harbour feat
for contrib/hbmysql lib: $ sudo apt-get install libmysqlclient15-dev
for contrib/hbodbc lib: $ sudo apt-get install unixodbc-dev
for contrib/hbpgsql lib: $ sudo apt-get install libpq-dev
+ for contrib/hbqt lib: $ sudo apt-get install libqt5-dev
Optional, to override locally hosted sources:
@@ -606,6 +615,7 @@ You'll need these packages to compile certain contribs and optional Harbour feat
for contrib/hbodbc lib: unixodbc-devel OR
unixODBC-devel
for contrib/hbpgsql lib: postgresql-devel
+ for contrib/hbqt lib: qt5-devel
> NOTES:
>
@@ -1144,6 +1154,7 @@ set HB_WITH_MYSQL=C:\mysql\include
set HB_WITH_OCILIB=C:\ocilib\include
set HB_WITH_OPENSSL=C:\openssl\inc32
set HB_WITH_PGSQL=C:\pgsql\include
+set HB_WITH_QT=C:\Qt\include
```
## on Windows x86-64 (64-bit) hosts
@@ -1151,7 +1162,7 @@ set HB_WITH_PGSQL=C:\pgsql\include
Same as 32-bit Windows, but, you'll have to change `%ProgramFiles%` to
`%ProgramFiles(x86)%` for 32-bit and mixed tools, you can build for
both x86 and x64 without building a native target first, and potential
-differences with some compilers in order to use native binaries if
+differences with some compilers in using native binaries if
they are available.
```batchfile
@@ -1481,7 +1492,7 @@ mailing list.
13. If your example involves compatibility components, make sure to test
it against original implementation (for example, test legacy Clipper
core language elements against real CA-Clipper 5.2e or 5.3b, or hbct
- functions against CT3 library, etc.)
+ functions against CT3 library, etc)
# Supported Platforms and C Compilers
@@ -1498,7 +1509,7 @@ mailing list.
* android - Android
* vxworks - VxWorks
* symbian - Symbian OS (experimental)
-* minix - Minix 3 (tested on 3.2.1; earlier releases will not work)
+* minix - Minix 3 (tested on 3.2.1; earlier releases won't work)
* aix - IBM AIX
* win - MS Windows (all flavors)
(see [External links](#external-links) for Win9x requirements)
@@ -1780,7 +1791,7 @@ Supported shells per host platforms:
* HB_WITH_FREEIMAGE - FreeImage [multiplatform, free, open-source]
*
* HB_WITH_GD - GD Graphics Library [multiplatform, free, open-source]
- *
+ *
* HB_WITH_GS - Ghostscript [multiplatform, free, open-source]
*
*
@@ -1813,6 +1824,9 @@ Supported shells per host platforms:
*
* HB_WITH_PNG - libpng [multiplatform, free, open-source]
*
+ * HB_WITH_QT - QT (GUI) [multiplatform, free, open-source]
+ *
+ *
* HB_WITH_SQLITE3 - sqlite3 [multiplatform, free, open-source]
*
* HB_WITH_TIFF - libtiff [multiplatform, free, open-source]
@@ -1851,6 +1865,8 @@ Supported shells per host platforms:
(not verified with current Harbour version)
* Valgrind (dynamic executable analysis tool) [linux, darwin-x86, free, open-source]
*
+ * ack (programmer grep) [multiplatform, free, open-source]
+ *
* Uncrustify (source formatter) [multiplatform, free, open-source]
*
* UPX (executable compressor) [win, dos, *nix, free, open-source]
@@ -1864,6 +1880,8 @@ Supported shells per host platforms:
* bzip2 [multiplatform, free, open-source]
Windows binary:
*
+ * Chocolatey (Windows package manager) [free, open-source]
+ *
* GNU Make
Windows binary + source:
diff --git a/contrib/gtqtc/gtqtc.hbc b/contrib/gtqtc/gtqtc.hbc
index 3095627cf7..4447fbeacd 100644
--- a/contrib/gtqtc/gtqtc.hbc
+++ b/contrib/gtqtc/gtqtc.hbc
@@ -3,15 +3,25 @@ description=Multi-Platform QT based GUI console (QTC)
gt=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF}
+depcontrol=qt5:${HB_WITH_QT}
+depkeyhead=qt5:QtCore/QJsonObject
+depoptional=qt5:yes
+depfinish=qt5
+
+{darwin}depcontrol=qt:${HB_WITH_QT}
+{darwin}depkeyhead=qt:QtCore/qglobal.h
+{darwin}depincpath=qt:/Developer/qt/include
+{darwin}depincpath=qt:/Library/Frameworks
+{darwin}depincpath=qt:/usr/local/include
+{darwin}depfinish=qt
+
{allwin|os2}libpaths=${HB_WITH_QT}/../lib
-
-{(HB_QT_MAJOR_VER='4')&(allwin|os2)}libs=QtCore4 QtGui4
-{(HB_QT_MAJOR_VER='4')&(linux|beos|symbian)}libs=QtCore QtGui
-{(HB_QT_MAJOR_VER='4')&(darwin)}frameworks=QtCore QtGui
-
-{(HB_QT_MAJOR_VER='5')&(allwin|os2)}libs=Qt5Core Qt5Gui Qt5Widgets Qt5PrintSupport
-{(HB_QT_MAJOR_VER='5')&(linux|beos|symbian)}libs=QtCore QtGui QtWidgets QtPrintSupport
-{(HB_QT_MAJOR_VER='5')&(darwin)}frameworks=QtCore QtGui QtWidgets QtPrintSupport
+{(allwin|os2)&!HBMK_HAS_QT5}libs=QtCore4 QtGui4
+{(allwin|os2)&HBMK_HAS_QT5}libs=Qt5Core Qt5Gui
+{linux|beos|symbian}libs=QtCore QtGui
+{darwin}ldflags=-F${HBMK_DIR_QT}/../lib
+{darwin}frameworks=QtCore QtGui
+{(bsd|darwin)}libs=stdc++
cpp=yes
gui=yes
diff --git a/contrib/gtqtc/gtqtc1.cpp b/contrib/gtqtc/gtqtc1.cpp
index 12f2f7da56..6395b31f7c 100644
--- a/contrib/gtqtc/gtqtc1.cpp
+++ b/contrib/gtqtc/gtqtc1.cpp
@@ -1420,16 +1420,22 @@ static void hb_gt_qtc_addKeyToInputQueue( PHB_GTQTC pQTC, int iKey )
{
int iHead = pQTC->keyHead;
- if( pQTC->keyHead != pQTC->keyTail && HB_INKEY_ISMOUSEPOS( iKey ) )
+ if( pQTC->keyHead != pQTC->keyTail )
{
- int iLastKey = pQTC->keyBuffer[ pQTC->keyLast ];
-
- /* Clipper strips repeated mouse movemnt - let's do the same */
- if( HB_INKEY_ISMOUSEPOS( iLastKey ) )
+ if( HB_INKEY_ISMOUSEPOS( iKey ) )
{
- pQTC->keyBuffer[ pQTC->keyLast ] = iKey;
- return;
+ int iLastKey = pQTC->keyBuffer[ pQTC->keyLast ];
+
+ /* Clipper strips repeated mouse movemnt - let's do the same */
+ if( HB_INKEY_ISMOUSEPOS( iLastKey ) )
+ {
+ pQTC->keyBuffer[ pQTC->keyLast ] = iKey;
+ return;
+ }
}
+ else if( iKey == HB_K_RESIZE &&
+ iKey == pQTC->keyBuffer[ pQTC->keyLast ] )
+ return;
}
/* When the buffer is full new event overwrite the last one
@@ -1679,24 +1685,21 @@ static void hb_gt_qtc_Refresh( PHB_GT pGT )
static HB_BOOL hb_gt_qtc_SetMode( PHB_GT pGT, int iRow, int iCol )
{
PHB_GTQTC pQTC;
- HB_BOOL fResult = HB_FALSE;
+ HB_BOOL fResult;
HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_SetMode(%p,%d,%d)", pGT, iRow, iCol ) );
pQTC = HB_GTQTC_GET( pGT );
-
- if( pQTC->qWnd )
+ fResult = hb_gt_qtc_setWindowSize( pQTC, iRow, iCol );
+ if( fResult )
{
- if( hb_gt_qtc_setWindowSize( pQTC, iRow, iCol ) )
+ if( pQTC->qWnd )
{
hb_gt_qtc_initWindow( pQTC, HB_TRUE );
HB_GTSELF_REFRESH( pGT );
}
- }
- else
- {
- fResult = hb_gt_qtc_setWindowSize( pQTC, iRow, iCol );
- HB_GTSELF_SEMICOLD( pGT );
+ else
+ HB_GTSELF_SEMICOLD( pGT );
}
return fResult;
@@ -1986,6 +1989,8 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
break;
case HB_GTI_MAXIMIZED:
+ if( pQTC->qWnd )
+ pQTC->fMaximized = ( pQTC->qWnd->windowState() & Qt::WindowMaximized ) != 0;
pInfo->pResult = hb_itemPutL( pInfo->pResult, pQTC->fMaximized );
if( pInfo->pNewVal && HB_IS_LOGICAL( pInfo->pNewVal ) &&
( hb_itemGetL( pInfo->pNewVal ) ? ! pQTC->fMaximized : pQTC->fMaximized ) )
@@ -1997,6 +2002,8 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
break;
case HB_GTI_ISFULLSCREEN:
+ if( pQTC->qWnd )
+ pQTC->fFullScreen = ( pQTC->qWnd->windowState() & Qt::WindowFullScreen ) != 0;
pInfo->pResult = hb_itemPutL( pInfo->pResult, pQTC->fFullScreen );
if( pInfo->pNewVal && HB_IS_LOGICAL( pInfo->pNewVal ) &&
( hb_itemGetL( pInfo->pNewVal ) ? ! pQTC->fFullScreen : pQTC->fFullScreen ) )
@@ -2185,8 +2192,8 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
switch( hb_arrayLen( pInfo->pNewVal2 ) )
{
case 2:
- rx.setTop( hb_arrayGetNI( pInfo->pNewVal2, 1 ) );
- rx.setLeft( hb_arrayGetNI( pInfo->pNewVal2, 2 ) );
+ rx.setLeft( hb_arrayGetNI( pInfo->pNewVal2, 1 ) );
+ rx.setTop( hb_arrayGetNI( pInfo->pNewVal2, 2 ) );
if( !qImg.isNull() )
rx.setSize( qImg.size() );
break;
@@ -2423,7 +2430,7 @@ void QTConsole::resetWindowSize( void )
void QTConsole::setFontSize( int iFH, int iFW )
{
- int iDec = 0, iHeight, iWidth, iAscent;
+ int iDec = 0, iDir, iHeight, iWidth, iAscent;
if( iFH < 4 )
iFH = 4;
@@ -2443,13 +2450,13 @@ void QTConsole::setFontSize( int iFH, int iFW )
if( iFW > 0 )
{
- if( iFW < 4 )
- iFW = 4;
- iDec = ( iFW * 100 ) / iWidth;
- if( iDec != 100 )
+ if( iFW < 2 )
+ iFW = 2;
+
+ if( iWidth != iFW )
{
- int iBase = iWidth;
- ++iDec;
+ iDec = ( iFW * 100 ) / iWidth;
+ iDir = iDec;
do
{
font.setStretch( iDec );
@@ -2457,23 +2464,35 @@ void QTConsole::setFontSize( int iFH, int iFW )
iHeight = fm.height();
iWidth = fm.averageCharWidth();
iAscent = fm.ascent();
- /* this is workaround for broken font metrix in
- * some X-Window systems [druzus]
- */
- if( iWidth <= iFW )
+
+ if( iWidth == iFW )
+ break;
+
+ if( iWidth < iFW )
{
- int iTmp = iWidth == iBase ? 100 : ( iFW * 100 ) / iWidth + 1;
- if( iTmp < iDec && iTmp >= 100 )
- {
- iDec = iTmp + 1;
- iWidth = iFW + 1;
- }
+ if( iDir <= iDec )
+ iDec++;
+ else
+ break;
}
+ else /* iWidth > iFW */
+ iDir = iDec--;
}
- while( iWidth > iFW && --iDec >= 10 );
+ while( iDec >= ( iDir >> 1 ) && iDec <= ( iDir << 1 ) );
}
}
+ if( ( iHeight < iFH || iWidth < iFW ) &&
+ ( pQTC->fontAttribute & HB_GTI_FONTA_CLRBKG ) != 0 &&
+ ( pQTC->fontAttribute & HB_GTI_FONTA_DRAWBOX ) != 0 &&
+ ( pQTC->fontAttribute & HB_GTI_FONTA_FIXMETRIC ) != 0 )
+ {
+ if( iHeight < iFH )
+ iHeight = iFH;
+ if( iWidth < iFW )
+ iWidth = iFW;
+ }
+
pQTC->fontHeight = iHeight;
pQTC->fontWidth = iWidth;
pQTC->fontAscent = iAscent;
@@ -3027,7 +3046,7 @@ void QTConsole::keyPressEvent( QKeyEvent * event )
if( pQTC->fAltEnter && ( iFlags & HB_KF_ALT ) != 0 &&
( iFlags & HB_KF_KEYPAD ) == 0 )
{
- pQTC->fFullScreen = ! pQTC->fFullScreen;
+ pQTC->fFullScreen = ( pQTC->qWnd->windowState() & Qt::WindowFullScreen ) == 0;
hb_gt_qtc_setWindowState( pQTC, Qt::WindowFullScreen, pQTC->fFullScreen );
return;
}
@@ -3324,17 +3343,13 @@ void QTCWindow::setWindowSize( void )
{
if( ( windowState() & ( Qt::WindowMaximized | Qt::WindowFullScreen ) ) != 0 )
{
- QRect rc( windowState() & Qt::WindowFullScreen ?
- QApplication::desktop()->screenGeometry() :
- QApplication::desktop()->availableGeometry() );
-
- qConsole->pQTC->marginLeft = rc.width() - qConsole->image->width();
+ qConsole->pQTC->marginLeft = rect().width() - qConsole->image->width();
if( qConsole->pQTC->marginLeft > 0 )
qConsole->pQTC->marginLeft >>= 1;
else
qConsole->pQTC->marginLeft = 0;
- qConsole->pQTC->marginTop = rc.height() - qConsole->image->height();
+ qConsole->pQTC->marginTop = rect().height() - qConsole->image->height();
if( qConsole->pQTC->marginTop > 0 )
qConsole->pQTC->marginTop >>= 1;
else
@@ -3354,14 +3369,27 @@ void QTCWindow::setResizing( void )
{
QRect rc( QApplication::desktop()->screenGeometry() );
- setMinimumWidth( qConsole->pQTC->iCols << 1 );
setMaximumWidth( rc.width() );
- setMinimumHeight( qConsole->pQTC->iRows << 2 );
setMaximumHeight( rc.height() );
+
if( qConsole->pQTC->iResizeMode == HB_GTI_RESIZEMODE_ROWS )
- setSizeIncrement( qConsole->pQTC->cellX, qConsole->pQTC->cellY );
+ {
+ setMinimumWidth( qConsole->pQTC->cellX << 1 );
+ setMinimumHeight( qConsole->pQTC->cellY << 1 );
+ if( windowState() & Qt::WindowMaximized )
+ setSizeIncrement( 0, 0 );
+ else
+ setSizeIncrement( qConsole->pQTC->cellX, qConsole->pQTC->cellY );
+ }
else
- setSizeIncrement( 0, 0 );
+ {
+ setMinimumWidth( qConsole->pQTC->iCols << 1 );
+ setMinimumHeight( qConsole->pQTC->iRows << 2 );
+ if( windowState() & Qt::WindowMaximized )
+ setSizeIncrement( 0, 0 );
+ else
+ setSizeIncrement( qConsole->pQTC->iCols, qConsole->pQTC->iRows );
+ }
}
else
{
diff --git a/contrib/gtqtc/hbmk2_qtmoc.hb b/contrib/gtqtc/hbmk2_qtmoc.hb
index 94fe722067..48125038ec 100644
--- a/contrib/gtqtc/hbmk2_qtmoc.hb
+++ b/contrib/gtqtc/hbmk2_qtmoc.hb
@@ -21,7 +21,7 @@
*
*/
-#pragma warninglevel=3
+#pragma -w3
#pragma -km+
#pragma -ko+
@@ -38,7 +38,6 @@ FUNCTION hbmk_plugin_qt( hbmk )
LOCAL cDst
LOCAL tSrc
LOCAL tDst
- LOCAL cTmp
LOCAL cCommand
LOCAL nError
@@ -49,15 +48,6 @@ FUNCTION hbmk_plugin_qt( hbmk )
hbmk_Register_Input_File_Extension( hbmk, ".h" )
- IF Empty( GetEnv( "HB_QT_MAJOR_VER" ) ) /* To honor Qt 5.0.1 */
- cTmp := qt_version_detect( hbmk, "uic", "UIC_BIN" )
- IF " 5." $ cTmp
- hb_SetEnv( "HB_QT_MAJOR_VER", "5" )
- ELSE
- hb_SetEnv( "HB_QT_MAJOR_VER", "4" )
- ENDIF
- ENDIF
-
EXIT
CASE "pre_all"
@@ -118,8 +108,8 @@ FUNCTION hbmk_plugin_qt( hbmk )
IF lBuildIt
cCommand := hbmk[ "vars" ][ "cMOC_BIN" ] +;
- " " + hbmk_FNameEscape( hbmk_PathSepToTarget( hbmk, cSrc ), hbmk[ "nCmd_Esc" ], hbmk[ "nCmd_FNF" ] ) +;
- " -o " + hbmk_FNameEscape( hbmk_PathSepToTarget( hbmk, cDst ), hbmk[ "nCmd_Esc" ], hbmk[ "nCmd_FNF" ] )
+ " " + hbmk_FNameEscape( hbmk, hbmk_PathSepToTarget( hbmk, cSrc ) ) +;
+ " -o " + hbmk_FNameEscape( hbmk, hbmk_PathSepToTarget( hbmk, cDst ) )
IF hbmk[ "lTRACE" ]
IF ! hbmk[ "lQUIET" ]
@@ -157,18 +147,6 @@ FUNCTION hbmk_plugin_qt( hbmk )
RETURN cRetVal
-
-STATIC FUNCTION qt_version_detect( hbmk, cName, cEnvQT, lPostfix )
- LOCAL cTmp := ""
- LOCAL cBIN := qt_tool_detect( hbmk, cName, cEnvQT, lPostfix )
-
- IF ! Empty( cBIN )
- hb_processRun( cBIN + " -v",,, @cTmp )
- ENDIF
-
- RETURN cTmp
-
-
STATIC FUNCTION qt_tool_detect( hbmk, cName, cEnvQT, lPostfix )
LOCAL cBIN
LOCAL cEnv