2010-01-03 21:19 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/hbqt_hbevents.cpp
* contrib/hbqt/hbqt_hbslots.cpp
- Deleted old method of slots/events handling.
* contrib/hbide/idethemes.prg
* contrib/hbide/ideeditor.prg
* contrib/hbide/hbide.prg
* contrib/hbide/idemisc.prg
* contrib/hbide/idesaveload.prg
% Using hb_FileExists() instead of File().
! Fixed to not force lowercase on filenames.
This commit is contained in:
@@ -17,6 +17,19 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-01-03 21:19 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbqt/hbqt_hbevents.cpp
|
||||
* contrib/hbqt/hbqt_hbslots.cpp
|
||||
- Deleted old method of slots/events handling.
|
||||
|
||||
* contrib/hbide/idethemes.prg
|
||||
* contrib/hbide/ideeditor.prg
|
||||
* contrib/hbide/hbide.prg
|
||||
* contrib/hbide/idemisc.prg
|
||||
* contrib/hbide/idesaveload.prg
|
||||
% Using hb_FileExists() instead of File().
|
||||
! Fixed to not force lowercase on filenames.
|
||||
|
||||
2010-01-03 11:57 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* contrib/hbxbp/xbpbrowse.prg
|
||||
* contrib/hbxbp/xbpwindow.prg
|
||||
|
||||
@@ -674,7 +674,7 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos, cTheme )
|
||||
RETURN Self
|
||||
ENDIF
|
||||
|
||||
IF !Empty( cSourceFile ) .AND. !File( cSourceFile )
|
||||
IF !Empty( cSourceFile ) .AND. !hb_FileExists( cSourceFile )
|
||||
MsgBox( 'File not found: ' + cSourceFile )
|
||||
RETURN Self
|
||||
ENDIF
|
||||
@@ -1078,7 +1078,7 @@ METHOD HbIde:appendProjectInTree( aPrj )
|
||||
aSrc := aPrj[ PRJ_PRP_SOURCES, 2 ]
|
||||
FOR j := 1 TO len( aSrc )
|
||||
hb_fNameSplit( aSrc[ j ], @cPath, @cFile, @cExt )
|
||||
cPathA := lower( strtran( cPath, "\", "/" ) )
|
||||
cPathA := strtran( cPath, "\", "/" )
|
||||
IF ( nPath := ascan( aPath, {|e_| e_[ 1 ] == cPathA } ) ) == 0
|
||||
oPP := oParent:addItem( cPath )
|
||||
aadd( ::aProjData, { oPP, "Path", oParent, cPathA, cProject } )
|
||||
@@ -1424,7 +1424,7 @@ METHOD HbIde:loadUI( cUi )
|
||||
LOCAL cUiFull := s_resPath + cUi + ".ui"
|
||||
LOCAL qDialog, qUiLoader, qFile
|
||||
|
||||
IF file( cUiFull )
|
||||
IF hb_FileExists( cUiFull )
|
||||
qFile := QFile():new( cUiFull )
|
||||
IF qFile:open( 1 )
|
||||
qUiLoader := QUiLoader():new()
|
||||
@@ -1487,7 +1487,7 @@ METHOD HbIde:loadProjectProperties( cProject, lNew, lFetch, lUpdateTree )
|
||||
IF lFetch
|
||||
::cSaveTo := ""
|
||||
::fetchProjectProperties()
|
||||
IF !empty( ::cSaveTo ) .and. file( ::cSaveTo )
|
||||
IF !empty( ::cSaveTo ) .and. hb_FileExists( ::cSaveTo )
|
||||
cProject := ::cSaveTo
|
||||
/* Reload from file */
|
||||
::aPrjProps := fetchHbiStructFromFile( cProject )
|
||||
@@ -1977,7 +1977,7 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt )
|
||||
IF ( nResult == 0 ) .AND. ( lLaunch )
|
||||
cTmp += CRLF
|
||||
|
||||
IF !File( cTargetFN )
|
||||
IF !hb_FileExists( cTargetFN )
|
||||
cTmp += "Launch application error: file not found " + cTargetFN + "!"
|
||||
|
||||
ELSEIF aPrj[ PRJ_PRP_PROPERTIES, 2, E_qPrjType ] == "Executable"
|
||||
@@ -2004,7 +2004,7 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt )
|
||||
FErase( cHbpPath )
|
||||
ENDIF
|
||||
|
||||
IF lPPO .AND. File( cFileName )
|
||||
IF lPPO .AND. hb_FileExists( cFileName )
|
||||
::aEdits[ 1 ]:showPPO( cFileName )
|
||||
ENDIF
|
||||
|
||||
|
||||
@@ -425,7 +425,7 @@ METHOD IdeEditor:setTabImage()
|
||||
METHOD IdeEditor:showPPO( cFile )
|
||||
LOCAL qEdit, qHiliter
|
||||
|
||||
IF file( cFile )
|
||||
IF hb_FileExists( cFile )
|
||||
qEdit := QPlainTextEdit():new()
|
||||
qEdit:setPlainText( hb_memoRead( cFile ) )
|
||||
qEdit:setLineWrapMode( QTextEdit_NoWrap )
|
||||
|
||||
@@ -143,7 +143,7 @@ FUNCTION CreateTarget( cFile, txt_ )
|
||||
fClose( hHandle )
|
||||
ENDIF
|
||||
|
||||
RETURN file( cFile )
|
||||
RETURN hb_FileExists( cFile )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -189,14 +189,9 @@ FUNCTION loadINI( oIde, cHbideIni )
|
||||
|
||||
DEFAULT cHbideIni TO "hbide.ini"
|
||||
|
||||
cHbideIni := lower( cHbideIni )
|
||||
lValid := .F.
|
||||
|
||||
IF !file( cHbideIni )
|
||||
cHbideIni := hb_dirBase() + "hbide.ini"
|
||||
ENDIF
|
||||
|
||||
IF !file( cHbideIni )
|
||||
IF ! hb_FileExists( cHbideIni )
|
||||
cHbideIni := hb_dirBase() + "hbide.ini"
|
||||
ENDIF
|
||||
|
||||
@@ -209,7 +204,7 @@ FUNCTION loadINI( oIde, cHbideIni )
|
||||
oIde:aIni[n] := Array(0)
|
||||
NEXT
|
||||
|
||||
IF file( oIde:cProjIni )
|
||||
IF hb_FileExists( oIde:cProjIni )
|
||||
aElem := ReadSource( oIde:cProjIni )
|
||||
|
||||
FOR EACH s IN aElem
|
||||
|
||||
@@ -230,7 +230,7 @@ METHOD IdeThemes:contains( cTheme )
|
||||
|
||||
METHOD IdeThemes:load( cFile )
|
||||
|
||||
IF hb_isChar( cFile ) .AND. !empty( cFile ) .AND. file( cFile )
|
||||
IF hb_isChar( cFile ) .AND. !empty( cFile ) .AND. hb_FileExists( cFile )
|
||||
::aIni:= ReadSource( cFile )
|
||||
::parseINI()
|
||||
::lDefault := .f.
|
||||
@@ -262,7 +262,7 @@ METHOD IdeThemes:save( lAsk )
|
||||
IF !empty( cFile )
|
||||
cINI := ::buildINI()
|
||||
hb_memowrit( cFile, cINI )
|
||||
IF file( cFile )
|
||||
IF hb_FileExists( cFile )
|
||||
::oIde:cIniThemes := cFile
|
||||
::cIniFile := cFile
|
||||
ENDIF
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* QT wrapper main header
|
||||
*
|
||||
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -64,107 +64,6 @@
|
||||
|
||||
#include "hbqt_hbevents.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HBEvents * t_events;
|
||||
} HB_EVENTS, * PHB_EVENTS;
|
||||
|
||||
static HB_TSD_NEW( s_events, sizeof( HB_EVENTS ), NULL, NULL );
|
||||
|
||||
#define HB_QTTHREAD_EVENTS() ( ( PHB_EVENTS ) hb_stackGetTSD( &s_events ) )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static HBEvents * qt_getEventFilter( void )
|
||||
{
|
||||
PHB_EVENTS p_events = HB_QTTHREAD_EVENTS();
|
||||
|
||||
if( ! p_events->t_events )
|
||||
p_events->t_events = new HBEvents();
|
||||
|
||||
return p_events->t_events;
|
||||
}
|
||||
|
||||
/* TOFIX: Possible GPF is below pointer is used by .prg after release. */
|
||||
HB_FUNC( QT_GETEVENTFILTER )
|
||||
{
|
||||
hb_retptr( qt_getEventFilter() );
|
||||
}
|
||||
|
||||
/* TOFIX: Leak if .prg code doesn't call this explicitly. */
|
||||
HB_FUNC( QT_EVENTS_DESTROY )
|
||||
{
|
||||
PHB_EVENTS p_events = HB_QTTHREAD_EVENTS();
|
||||
|
||||
if( p_events->t_events )
|
||||
{
|
||||
p_events->t_events->~HBEvents();
|
||||
p_events->t_events = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
HB_FUNC( QT_CONNECT_EVENT )
|
||||
{
|
||||
QObject * object = ( QObject* ) hbqt_pPtrFromObj( 1 ); /* get sender */
|
||||
|
||||
if( object )
|
||||
{
|
||||
int type = hb_parni( 2 );
|
||||
PHB_ITEM codeblock = hb_itemNew( hb_param( 3, HB_IT_BLOCK | HB_IT_BYREF ) );
|
||||
HBEvents * t_events = qt_getEventFilter();
|
||||
|
||||
char prop[ 20 ];
|
||||
hb_snprintf( prop, sizeof( prop ), "%s%i%s", "P", type, "P" ); /* Make it a unique identifier */
|
||||
|
||||
t_events->listBlock << codeblock;
|
||||
/* TOFIX: Reference to GC collected pointer is stored. */
|
||||
t_events->listObj << object;
|
||||
|
||||
object->setProperty( prop, ( int ) t_events->listBlock.size() );
|
||||
|
||||
hb_retl( HB_TRUE );
|
||||
}
|
||||
else
|
||||
hb_retl( HB_FALSE );
|
||||
}
|
||||
|
||||
HB_FUNC( QT_DISCONNECT_EVENT )
|
||||
{
|
||||
HB_BOOL bRet = HB_FALSE;
|
||||
QObject * object = ( QObject* ) hbqt_pPtrFromObj( 1 );
|
||||
|
||||
if( object )
|
||||
{
|
||||
int type = hb_parni( 2 );
|
||||
HBEvents * t_events = qt_getEventFilter();
|
||||
|
||||
char prop[ 20 ];
|
||||
hb_snprintf( prop, sizeof( prop ), "%s%i%s", "P", type, "P" ); /* Make it a unique identifier */
|
||||
|
||||
int i = object->property( prop ).toInt();
|
||||
if( i > 0 && i <= t_events->listBlock.size() )
|
||||
{
|
||||
hb_itemRelease( t_events->listBlock.at( i - 1 ) );
|
||||
t_events->listBlock[ i - 1 ] = NULL;
|
||||
t_events->listObj[ i - 1 ] = NULL;
|
||||
object->setProperty( prop, QVariant() );
|
||||
bRet = HB_TRUE;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( " QT_DISCONNECT_EVENT: %i", type ) );
|
||||
}
|
||||
}
|
||||
|
||||
hb_retl( bRet );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include <QPointer>
|
||||
#include <QVariant>
|
||||
|
||||
@@ -226,14 +125,6 @@ static void * hbqt_gcAllocate_HBEvents( void * pObj )
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/* TOFIX: Possible GPF is below pointer is used by .prg after release. */
|
||||
HB_FUNC( QT_EVENTS_PTR )
|
||||
{
|
||||
hb_retptr( hbqt_par_HBEvents( 1 ) );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
HBEvents::HBEvents( QObject * parent ) : QObject( parent )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* QT wrapper main header
|
||||
*
|
||||
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -64,41 +64,10 @@
|
||||
|
||||
#include "hbqt_hbslots.h"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HBSlots * t_slots;
|
||||
} HB_SLOTS, * PHB_SLOTS;
|
||||
|
||||
static HB_TSD_NEW( s_slots, sizeof( HB_SLOTS ), NULL, NULL );
|
||||
|
||||
#define HB_QTTHREAD_SLOTS() ( ( PHB_SLOTS ) hb_stackGetTSD( &s_slots ) )
|
||||
#include <QPointer>
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static HBSlots * qt_getEventSlots( void )
|
||||
{
|
||||
PHB_SLOTS p_slots = HB_QTTHREAD_SLOTS();
|
||||
|
||||
if( ! p_slots->t_slots )
|
||||
p_slots->t_slots = new HBSlots();
|
||||
|
||||
return p_slots->t_slots;
|
||||
}
|
||||
|
||||
/* TOFIX: Leak if .prg code doesn't call this explicitly. */
|
||||
HB_FUNC( QT_SLOTS_DESTROY )
|
||||
{
|
||||
PHB_SLOTS p_slots = HB_QTTHREAD_SLOTS();
|
||||
|
||||
if( p_slots->t_slots )
|
||||
{
|
||||
p_slots->t_slots->~HBSlots();
|
||||
p_slots->t_slots = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static bool connect_signal( QString signal, QObject * object, HBSlots * t_slots )
|
||||
{
|
||||
bool ret;
|
||||
@@ -351,62 +320,6 @@ static bool disconnect_signal( QObject * object, const char * signal )
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Harbour function to connect signals with slots
|
||||
*/
|
||||
HB_FUNC( QT_CONNECT_SIGNAL )
|
||||
{
|
||||
QObject * object = ( QObject * ) hbqt_pPtrFromObj( 1 ); /* get sender */
|
||||
|
||||
if( object )
|
||||
{
|
||||
QString signal = hb_parcx( 2 ); /* get signal */
|
||||
HBSlots * t_slots = qt_getEventSlots();
|
||||
|
||||
if( connect_signal( signal, object, t_slots ) )
|
||||
{
|
||||
PHB_ITEM pBlock = hb_itemNew( hb_param( 3, HB_IT_BLOCK ) ); /* get codeblock */
|
||||
t_slots->listBlock << pBlock;
|
||||
object->setProperty( hb_parcx( 2 ), ( int ) t_slots->listBlock.size() );
|
||||
hb_retl( HB_TRUE );
|
||||
}
|
||||
else
|
||||
hb_retl( HB_FALSE );
|
||||
}
|
||||
else
|
||||
hb_retl( HB_FALSE );
|
||||
}
|
||||
|
||||
/*
|
||||
* harbour function to disconnect signals
|
||||
*/
|
||||
HB_FUNC( QT_DISCONNECT_SIGNAL )
|
||||
{
|
||||
QObject * object = ( QObject* ) hbqt_pPtrFromObj( 1 );
|
||||
bool bFreed = false;
|
||||
|
||||
if( object )
|
||||
{
|
||||
HBSlots * t_slots = qt_getEventSlots();
|
||||
const char * signal = hb_parcx( 2 );
|
||||
int i = object->property( signal ).toInt();
|
||||
|
||||
if( i > 0 && i <= t_slots->listBlock.size() )
|
||||
{
|
||||
hb_itemRelease( t_slots->listBlock.at( i - 1 ) );
|
||||
t_slots->listBlock[ i - 1 ] = NULL;
|
||||
|
||||
bFreed = disconnect_signal( object, signal );
|
||||
|
||||
//HB_TRACE( HB_TR_DEBUG, ( " QT_DISCONNECT_SIGNAL: %s %s", bFreed ? "YES" : "NO", signal ) );
|
||||
}
|
||||
}
|
||||
hb_retl( bFreed );
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user