Skip to content

Commit

Permalink
2024-12-15 20:54 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
Browse files Browse the repository at this point in the history
  * contrib/gtqtc/gtqtc.h
  * contrib/gtqtc/gtqtc.hbc
  * contrib/gtqtc/gtqtc.hbp
  * contrib/gtqtc/gtqtc1.cpp
    * updated to compile with Qt6
  • Loading branch information
druzus committed Dec 15, 2024
1 parent 1b57427 commit 9b389a9
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 61 deletions.
7 changes: 7 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */

2024-12-15 20:54 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/gtqtc/gtqtc.h
* contrib/gtqtc/gtqtc.hbc
* contrib/gtqtc/gtqtc.hbp
* contrib/gtqtc/gtqtc1.cpp
* updated to compile with Qt6

2024-12-13 09:06 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/compiler/harbour.y
* src/macro/macro.y
Expand Down
16 changes: 12 additions & 4 deletions contrib/gtqtc/gtqtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@
#define HB_GT_NAME QTC

#include <QtCore/QThread>
#include <QtCore/QMutex>
#if QT_VERSION >= 0x060000
#include <QtCore/QRecursiveMutex>
#else
#include <QtCore/QMutex>
#endif

#include <QtGui/QFont>
#include <QtGui/QColor>
Expand All @@ -69,22 +73,26 @@
#include <QtGui/QScreen>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QDesktopWidget>
#include <QtWidgets/QWidget>
#include <QtWidgets/QMessageBox>
#include <QtWidgets/QAbstractButton>
#include <QtWidgets/QAction>
#if QT_VERSION < 0x060000
#include <QtWidgets/QAction>
#include <QtWidgets/QDesktopWidget>
#else
#include <QtGui/QAction>
#endif
#ifdef HB_QT_SOUND
#include <QtMultimedia/QSound>
#endif
#else
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QDesktopWidget>
#include <QtGui/QWidget>
#include <QtGui/QMessageBox>
#include <QtGui/QAbstractButton>
#include <QtGui/QAction>
#include <QtGui/QDesktopWidget>
#ifdef HB_QT_SOUND
#include <QtGui/QSound>
#endif
Expand Down
69 changes: 41 additions & 28 deletions contrib/gtqtc/gtqtc.hbc
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,54 @@ description=Multi-platform QT based GUI console (QTC)

gt=${_HB_DYNPREF}${hb_name}${_HB_DYNSUFF}

deppkgname=qt5:qt5
depcontrol=qt5:${HB_WITH_QT}
depkeyhead=qt5:QtCore/QJsonObject
depoptional=qt5:yes
depincpath=qt5:/usr/include/x86_64-linux-gnu/qt5{linux}
depincpath=qt5:/usr/local/opt/qt5/include{darwin}
depincpath=qt5:/usr/local/include/qt5{bsd}
depfinish=qt5
deppkgname=qt6:qt6
depcontrol=qt6:${HB_WITH_QT}
depkeyhead=qt6:QtCore/QAdoptSharedDataTag
depoptional=qt6:yes
depincpath=qt6:/usr/include/x86_64-linux-gnu/qt6{linux}
depincpath=qt6:/usr/local/opt/qt6/include{darwin}
depincpath=qt6:/usr/local/include/qt6{bsd}
depfinish=qt6

{!HBMK_HAS_QT5&!darwin&!android}deppkgname=qt:QtCore
{!HBMK_HAS_QT5}deppkgname=qt:qt4
{!HBMK_HAS_QT5}depcontrol=qt:${HB_WITH_QT}
{!HBMK_HAS_QT5}depkeyhead=qt:QtCore/qglobal.h
{!HBMK_HAS_QT5&bsd}depincpath=qt:/usr/local/include/qt4
{!HBMK_HAS_QT5&beos}depincpath=qt:/boot/common/include
{!HBMK_HAS_QT5&darwin}depincpath=qt:/Developer/qt/include
{!HBMK_HAS_QT5&darwin}depincpath=qt:/Library/Frameworks
{!HBMK_HAS_QT5&darwin}depincpath=qt:/usr/local/include
{!HBMK_HAS_QT5}depfinish=qt
{!HBMK_HAS_QT6}deppkgname=qt5:qt5
{!HBMK_HAS_QT6}depcontrol=qt5:${HB_WITH_QT}
{!HBMK_HAS_QT6}depkeyhead=qt5:QtCore/QJsonObject
{!HBMK_HAS_QT6}depoptional=qt5:yes
{!HBMK_HAS_QT6}depincpath=qt5:/usr/include/x86_64-linux-gnu/qt5{linux}
{!HBMK_HAS_QT6}depincpath=qt5:/usr/local/opt/qt5/include{darwin}
{!HBMK_HAS_QT6}depincpath=qt5:/usr/local/include/qt5{bsd}
{!HBMK_HAS_QT6}depfinish=qt5

{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&!darwin&!android}deppkgname=qt:QtCore
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)}deppkgname=qt:qt4
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)}depcontrol=qt:${HB_WITH_QT}
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)}depkeyhead=qt:QtCore/qglobal.h
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&bsd}depincpath=qt:/usr/local/include/qt4
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&beos}depincpath=qt:/boot/common/include
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&darwin}depincpath=qt:/Developer/qt/include
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&darwin}depincpath=qt:/Library/Frameworks
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&darwin}depincpath=qt:/usr/local/include
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)}depfinish=qt

{(allwin|os2)|HBMK_HAS_QT}libpaths=${HBMK_DIR_QT}/../lib
{(allwin|os2)|HBMK_HAS_QT5}libpaths=${HBMK_DIR_QT5}/../lib
{(allwin|os2)|(HBMK_HAS_QT5|HBMK_HAS_QT6)}libpaths=${HBMK_DIR_QT5}/../lib
{(allwin|os2)|HBMK_HAS_QT6}libpaths=${HBMK_DIR_QT6}/../lib
{bsd&HBMK_HAS_QT}libpaths=/usr/local/lib/qt4
{bsd&HBMK_HAS_QT5}libpaths=/usr/local/lib/qt5
{(allwin|os2)&!HBMK_HAS_QT5}libs=QtCore4 QtGui4
{bsd&(HBMK_HAS_QT5|HBMK_HAS_QT6)}libpaths=/usr/local/lib/qt5
{bsd&HBMK_HAS_QT6}libpaths=/usr/local/lib/qt6
{(allwin|os2)&HBMK_HAS_QT}libs=QtCore4 QtGui4
{(allwin|os2|linux|bsd|beos|symbian)&HBMK_HAS_QT5}libs=Qt5Core Qt5Gui Qt5Widgets
{(allwin|os2|linux|bsd|beos|symbian)&HBMK_HAS_QT6}libs=Qt6Core Qt6Gui Qt6Widgets
{(allwin|os2|linux|bsd|beos|symbian)&HBMK_HAS_QT5&HB_QT_SOUND='yes'}libs=Qt5Multimedia
{(linux|beos|symbian)&!HBMK_HAS_QT5}libs=QtCore QtGui
{!HBMK_HAS_QT5&darwin}ldflags=-F${HBMK_DIR_QT}/../lib
{!HBMK_HAS_QT5&darwin}dflags=-F${HBMK_DIR_QT}/../lib
{HBMK_HAS_QT5&darwin}ldflags=-F${HBMK_DIR_QT5}/../lib
{HBMK_HAS_QT5&darwin}dflags=-F${HBMK_DIR_QT5}/../lib
{(allwin|os2|linux|bsd|beos|symbian)&HBMK_HAS_QT6&HB_QT_SOUND='yes'}libs=Qt6Multimedia
{(linux|beos|symbian)&HBMK_HAS_QT}libs=QtCore QtGui
{HBMK_HAS_QT&darwin}ldflags=-F${HBMK_DIR_QT}/../lib
{HBMK_HAS_QT&darwin}dflags=-F${HBMK_DIR_QT}/../lib
{(HBMK_HAS_QT5|HBMK_HAS_QT6)&darwin}ldflags=-F${HBMK_DIR_QT5}/../lib
{(HBMK_HAS_QT5|HBMK_HAS_QT6)&darwin}dflags=-F${HBMK_DIR_QT5}/../lib
{darwin}frameworks=QtCore QtGui
{darwin&HBMK_HAS_QT5}frameworks=QtWidgets
{darwin&HBMK_HAS_QT5&HB_QT_SOUND='yes'}frameworks=QtMultimedia
{darwin&(HBMK_HAS_QT5|HBMK_HAS_QT6)}frameworks=QtWidgets
{darwin&(HBMK_HAS_QT5|HBMK_HAS_QT6)&HB_QT_SOUND='yes'}frameworks=QtMultimedia
{bsd|darwin}libs=stdc++

cpp=yes
Expand Down
56 changes: 33 additions & 23 deletions contrib/gtqtc/gtqtc.hbp
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,39 @@

-plugin=hbmk2_qtgt.hb

-deppkgname=qt5:qt5
-depkeyhead=qt5:QtCore/QJsonObject
-depcontrol=qt5:${HB_WITH_QT}
{HB_BUILD_3RDEXT='no'}-depoptional=qt5:no
-depoptional=qt5:yes
-depincpath=qt5:/usr/include/x86_64-linux-gnu/qt5{linux}
-depincpath=qt5:/usr/local/opt/qt5/include{darwin}
-depincpath=qt5:/usr/local/include/qt5{bsd}
-depfinish=qt5

{!HBMK_HAS_QT5&!darwin&!android}-deppkgname=qt:QtCore
{!HBMK_HAS_QT5}-deppkgname=qt:qt4
{!HBMK_HAS_QT5}-depkeyhead=qt:QtCore/qglobal.h
{!HBMK_HAS_QT5}-depcontrol=qt:${HB_WITH_QT}
{!HBMK_HAS_QT5&HB_BUILD_3RDEXT='no'}-depcontrol=qt:no
{!HBMK_HAS_QT5&!darwin&!android}-depincpath=qt:/usr/include/qt4
{!HBMK_HAS_QT5&!darwin&!android}-depincpath=qt:/usr/lib/qt4/include
{!HBMK_HAS_QT5&!darwin&!android}-depincpath=qt:/usr/include
{!HBMK_HAS_QT5&bsd}-depincpath=qt:/usr/local/include/qt4
{!HBMK_HAS_QT5&beos}-depincpath=qt:/boot/common/include
{!HBMK_HAS_QT5&darwin}-depincpath=qt:/Developer/qt/include
{!HBMK_HAS_QT5&darwin}-depincpath=qt:/Library/Frameworks
{!HBMK_HAS_QT5&darwin}-depincpath=qt:/usr/local/include
-deppkgname=qt6:qt6
-depkeyhead=qt6:QtCore/QAdoptSharedDataTag
-depcontrol=qt6:${HB_WITH_QT}
{HB_BUILD_3RDEXT='no'}-depoptional=qt6:no
-depoptional=qt6:yes
-depincpath=qt6:/usr/include/x86_64-linux-gnu/qt6{linux}
-depincpath=qt6:/usr/local/opt/qt6/include{darwin}
-depincpath=qt6:/usr/local/include/qt6{bsd}
-depfinish=qt6

{!HBMK_HAS_QT6}-deppkgname=qt5:qt5
{!HBMK_HAS_QT6}-depkeyhead=qt5:QtCore/QJsonObject
{!HBMK_HAS_QT6}-depcontrol=qt5:${HB_WITH_QT}
{!HBMK_HAS_QT6&HB_BUILD_3RDEXT='no'}-depoptional=qt5:no
{!HBMK_HAS_QT6}-depoptional=qt5:yes
{!HBMK_HAS_QT6}-depincpath=qt5:/usr/include/x86_64-linux-gnu/qt5{linux}
{!HBMK_HAS_QT6}-depincpath=qt5:/usr/local/opt/qt5/include{darwin}
{!HBMK_HAS_QT6}-depincpath=qt5:/usr/local/include/qt5{bsd}
{!HBMK_HAS_QT6}-depfinish=qt5

{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&!darwin&!android}-deppkgname=qt:QtCore
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)}-deppkgname=qt:qt4
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)}-depkeyhead=qt:QtCore/qglobal.h
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)}-depcontrol=qt:${HB_WITH_QT}
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&HB_BUILD_3RDEXT='no'}-depcontrol=qt:no
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&!darwin&!android}-depincpath=qt:/usr/include/qt4
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&!darwin&!android}-depincpath=qt:/usr/lib/qt4/include
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&!darwin&!android}-depincpath=qt:/usr/include
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&bsd}-depincpath=qt:/usr/local/include/qt4
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&beos}-depincpath=qt:/boot/common/include
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&darwin}-depincpath=qt:/Developer/qt/include
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&darwin}-depincpath=qt:/Library/Frameworks
{!(HBMK_HAS_QT5|HBMK_HAS_QT6)&darwin}-depincpath=qt:/usr/local/include

{HB_QT_SOUND='yes'}-cflag+=-DHB_QT_SOUND

Expand Down
42 changes: 36 additions & 6 deletions contrib/gtqtc/gtqtc1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ static HB_GT_FUNCS SuperTable;
#endif

#ifdef HB_QT_NEEDLOCKS
static QMutex s_qMtx( QMutex::Recursive );
# if QT_VERSION >= 0x060000
static QRecursiveMutex s_qMtx;
# else
static QMutex s_qMtx( QMutex::Recursive );
# endif
# define HB_QTC_LOCK() do { s_qMtx.lock()
# define HB_QTC_UNLOCK() s_qMtx.unlock(); } while( 0 )
#else
Expand Down Expand Up @@ -97,6 +101,8 @@ static void hb_gt_qtc_itemGetQString( PHB_ITEM pItem, QString * pqStr )
{
#if defined( HB_OS_WIN )
* pqStr = QString::fromWCharArray( wStr, nSize );
#elif QT_VERSION >= 0x060000
* pqStr = QString::fromUtf16( ( char16_t * ) wStr, nSize );
#else
* pqStr = QString::fromUtf16( wStr, nSize );
#endif
Expand Down Expand Up @@ -1990,7 +1996,11 @@ static HB_BOOL hb_gt_qtc_mouse_ButtonState( PHB_GT pGT, int iButton )
case 1:
return ( QApplication::mouseButtons() & Qt::RightButton ) != 0;
case 2:
#if QT_VERSION >= 0x060000
return ( QApplication::mouseButtons() & Qt::MiddleButton ) != 0;
#else
return ( QApplication::mouseButtons() & Qt::MidButton ) != 0;
#endif
}
return HB_FALSE;
}
Expand Down Expand Up @@ -3236,7 +3246,10 @@ void QTConsole::mouseMoveEvent( QMouseEvent * evt )
update( QRegion( rSel1 ).xored( QRegion( rSel2 ) ) );
}
else
hb_gt_qtc_setMouseKey( pQTC, evt->x(), evt->y(), 0, evt->modifiers() );
{
QPoint pos = evt->pos();
hb_gt_qtc_setMouseKey( pQTC, pos.x(), pos.y(), 0, evt->modifiers() );
}
}

void QTConsole::wheelEvent( QWheelEvent * evt )
Expand Down Expand Up @@ -3297,7 +3310,11 @@ void QTConsole::mouseDoubleClickEvent( QMouseEvent * evt )
iKey = K_RDBLCLK;
break;

#if QT_VERSION >= 0x060000
case Qt::MiddleButton:
#else
case Qt::MidButton:
#endif
iKey = K_MDBLCLK;
break;

Expand All @@ -3306,7 +3323,8 @@ void QTConsole::mouseDoubleClickEvent( QMouseEvent * evt )
return;
}

hb_gt_qtc_setMouseKey( pQTC, evt->x(), evt->y(), iKey, evt->modifiers() );
QPoint pos = evt->pos();
hb_gt_qtc_setMouseKey( pQTC, pos.x(), pos.y(), iKey, evt->modifiers() );
}

void QTConsole::mousePressEvent( QMouseEvent * evt )
Expand All @@ -3318,8 +3336,10 @@ void QTConsole::mousePressEvent( QMouseEvent * evt )
case Qt::LeftButton:
if( ! selectMode && ( evt->modifiers() & Qt::ShiftModifier ) )
{
QPoint pos = evt->pos();

selectMode = true;
selectRect.setCoords( evt->x(), evt->y(), evt->x(), evt->y() );
selectRect.setCoords( pos.x(), pos.y(), pos.x(), pos.y() );
update( hb_gt_qtc_unmapRect( pQTC, hb_gt_qtc_mapRect( pQTC, image, selectRect ) ) );
return;
}
Expand All @@ -3330,7 +3350,11 @@ void QTConsole::mousePressEvent( QMouseEvent * evt )
iKey = K_RBUTTONDOWN;
break;

#if QT_VERSION >= 0x060000
case Qt::MiddleButton:
#else
case Qt::MidButton:
#endif
iKey = K_MBUTTONDOWN;
break;

Expand All @@ -3339,7 +3363,8 @@ void QTConsole::mousePressEvent( QMouseEvent * evt )
return;
}

hb_gt_qtc_setMouseKey( pQTC, evt->x(), evt->y(), iKey, evt->modifiers() );
QPoint pos = evt->pos();
hb_gt_qtc_setMouseKey( pQTC, pos.x(), pos.y(), iKey, evt->modifiers() );
}

void QTConsole::mouseReleaseEvent( QMouseEvent * evt )
Expand All @@ -3361,7 +3386,11 @@ void QTConsole::mouseReleaseEvent( QMouseEvent * evt )
iKey = K_RBUTTONUP;
break;

#if QT_VERSION >= 0x060000
case Qt::MiddleButton:
#else
case Qt::MidButton:
#endif
iKey = K_MBUTTONUP;
break;

Expand All @@ -3370,7 +3399,8 @@ void QTConsole::mouseReleaseEvent( QMouseEvent * evt )
return;
}

hb_gt_qtc_setMouseKey( pQTC, evt->x(), evt->y(), iKey, evt->modifiers() );
QPoint pos = evt->pos();
hb_gt_qtc_setMouseKey( pQTC, pos.x(), pos.y(), iKey, evt->modifiers() );
}

bool QTConsole::event( QEvent * evt )
Expand Down

0 comments on commit 9b389a9

Please sign in to comment.